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/01/10 20:58:31 UTC
svn commit: r610906 [4/4] - in
/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking: ./
src/documentation/content/xdocs/trunk/ src/java/org/apache/fop/apps/
src/java/org/apache/fop/area/ src/java/org/apache/fop/fo/
src/java/org/apache/fop/fo/e...
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Thu Jan 10 11:58:23 2008
@@ -505,17 +505,6 @@
}
/**
- * Reset the position of the layout.
- *
- * @param resetPos the position to reset to
- */
- public void resetPosition(Position resetPos) {
- if (resetPos == null) {
- reset(null);
- }
- }
-
- /**
* {@inheritDoc}
*/
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Thu Jan 10 11:58:23 2008
@@ -74,7 +74,7 @@
* Main constructor
* @param parent Parent layout manager
*/
- public TableContentLayoutManager(TableLayoutManager parent) {
+ TableContentLayoutManager(TableLayoutManager parent) {
this.tableLM = parent;
Table table = getTableLM().getTable();
this.bodyIter = new TableRowIterator(table, TableRowIterator.BODY);
@@ -89,7 +89,7 @@
/**
* @return the table layout manager
*/
- public TableLayoutManager getTableLM() {
+ TableLayoutManager getTableLM() {
return this.tableLM;
}
@@ -101,7 +101,7 @@
/**
* @return the column setup of this table
*/
- public ColumnSetup getColumns() {
+ ColumnSetup getColumns() {
return getTableLM().getColumns();
}
@@ -136,7 +136,6 @@
if (headerIter != null && headerList == null) {
this.headerList = getKnuthElementsForRowIterator(
headerIter, context, alignment, TableRowIterator.HEADER);
- ElementListUtils.removeLegalBreaks(this.headerList);
this.headerNetHeight
= ElementListUtils.calcContentLength(this.headerList);
if (log.isDebugEnabled()) {
@@ -157,7 +156,6 @@
if (footerIter != null && footerList == null) {
this.footerList = getKnuthElementsForRowIterator(
footerIter, context, alignment, TableRowIterator.FOOTER);
- ElementListUtils.removeLegalBreaks(this.footerList);
this.footerNetHeight
= ElementListUtils.calcContentLength(this.footerList);
if (log.isDebugEnabled()) {
@@ -283,7 +281,7 @@
* @param parentIter the position iterator
* @param layoutContext the layout context for adding areas
*/
- public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) {
+ void addAreas(PositionIterator parentIter, LayoutContext layoutContext) {
this.usedBPD = 0;
RowPainter painter = new RowPainter(this, layoutContext);
@@ -389,7 +387,7 @@
if (pos instanceof TableContentPosition) {
TableContentPosition tcpos = (TableContentPosition)pos;
lst.add(tcpos);
- GridUnitPart part = (GridUnitPart)tcpos.gridUnitParts.get(0);
+ CellPart part = (CellPart)tcpos.cellParts.get(0);
if (body == null) {
body = part.pgu.getBody();
}
@@ -439,7 +437,7 @@
* @param row the table-row object or null
* @return the row area or null if there's no background to paint
*/
- public Block getRowArea(TableRow row) {
+ Block getRowArea(TableRow row) {
if (row == null || !row.getCommonBorderPaddingBackground().hasBackground()) {
return null;
} else {
@@ -457,7 +455,7 @@
* @param ipd inline-progression-dimension of the row
* @param yoffset Y offset at which to paint
*/
- public void addRowBackgroundArea(TableRow row, int bpd, int ipd, int yoffset) {
+ void addRowBackgroundArea(TableRow row, int bpd, int ipd, int yoffset) {
//Add row background if any
Block rowBackground = getRowArea(row);
if (rowBackground != null) {
@@ -476,14 +474,14 @@
* Sets the overall starting x-offset. Used for proper placement of cells.
* @param startXOffset starting x-offset (table's start-indent)
*/
- public void setStartXOffset(int startXOffset) {
+ void setStartXOffset(int startXOffset) {
this.startXOffset = startXOffset;
}
/**
* @return the amount of block-progression-dimension used by the content
*/
- public int getUsedBPD() {
+ int getUsedBPD() {
return this.usedBPD;
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java Thu Jan 10 11:58:23 2008
@@ -36,8 +36,8 @@
/** The position is the last of the row group. */
public static final int LAST_IN_ROWGROUP = 2;
- /** the list of GridUnitParts making up this position */
- protected List gridUnitParts;
+ /** the list of CellParts making up this position */
+ protected List cellParts;
/** effective row this position belongs to */
protected EffRow row;
/** flags for the position */
@@ -46,13 +46,13 @@
/**
* Creates a new TableContentPosition.
* @param lm applicable layout manager
- * @param gridUnitParts the list of GridUnitPart instances
+ * @param cellParts the list of CellPart instances
* @param row effective row this position belongs to
*/
- protected TableContentPosition(LayoutManager lm, List gridUnitParts,
+ protected TableContentPosition(LayoutManager lm, List cellParts,
EffRow row) {
super(lm);
- this.gridUnitParts = gridUnitParts;
+ this.cellParts = cellParts;
this.row = row;
}
@@ -90,7 +90,7 @@
sb.append(getFlag(FIRST_IN_ROWGROUP) ? "F" : "-");
sb.append(getFlag(LAST_IN_ROWGROUP) ? "L" : "-").append("]");
sb.append("(");
- sb.append(gridUnitParts);
+ sb.append(cellParts);
sb.append(")");
return sb.toString();
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Thu Jan 10 11:58:23 2008
@@ -404,17 +404,6 @@
}
}
- /**
- * Reset the position of this layout manager.
- *
- * @param resetPos the position to reset to
- */
- public void resetPosition(Position resetPos) {
- if (resetPos == null) {
- reset(null);
- }
- }
-
/** {@inheritDoc} */
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
// TODO Auto-generated method stub
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableStepper.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/layoutmgr/table/TableStepper.java Thu Jan 10 11:58:23 2008
@@ -75,6 +75,7 @@
private void setup(int columnCount) {
this.columnCount = columnCount;
this.activeRowIndex = 0;
+ this.previousRowsLength = 0;
}
/**
@@ -169,26 +170,27 @@
boolean forcedBreak = false;
int breakClass = -1;
//Put all involved grid units into a list
- List gridUnitParts = new java.util.ArrayList(maxColumnCount);
+ List cellParts = new java.util.ArrayList(maxColumnCount);
for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
ActiveCell activeCell = (ActiveCell) iter.next();
if (activeCell.contributesContent()) {
- GridUnitPart gup = activeCell.createGridUnitPart();
- gridUnitParts.add(gup);
+ CellPart part = activeCell.createCellPart();
+ cellParts.add(part);
forcedBreak = activeCell.isLastForcedBreak();
if (forcedBreak) {
breakClass = activeCell.getLastBreakClass();
}
- if (returnList.size() == 0 && gup.isFirstPart() && gup.mustKeepWithPrevious()) {
+ if (returnList.size() == 0 && part.isFirstPart()
+ && part.mustKeepWithPrevious()) {
context.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING);
}
}
}
- //log.debug(">>> guPARTS: " + gridUnitParts);
+ //log.debug(">>> guPARTS: " + cellParts);
//Create elements for step
TableContentPosition tcpos = new TableContentPosition(getTableLM(),
- gridUnitParts, rowGroup[normalRow]);
+ cellParts, rowGroup[normalRow]);
if (returnList.size() == 0) {
tcpos.setFlag(TableContentPosition.FIRST_IN_ROWGROUP, true);
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFDictionary.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFDictionary.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFDictionary.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFDictionary.java Thu Jan 10 11:58:23 2008
@@ -101,16 +101,26 @@
*/
protected void writeDictionary(StringBuffer sb) {
sb.append("<<");
+ boolean compact = (this.order.size() <= 2);
Iterator iter = this.order.iterator();
while (iter.hasNext()) {
String key = (String)iter.next();
- sb.append("\n /");
- sb.append(key);
- sb.append(" ");
+ if (compact) {
+ sb.append(' ');
+ } else {
+ sb.append("\n ");
+ }
+ sb.append('/').append(key);
+ sb.append(' ');
Object obj = this.entries.get(key);
formatObject(obj, sb);
}
- sb.append("\n>>\n");
+ if (compact) {
+ sb.append(' ');
+ } else {
+ sb.append('\n');
+ }
+ sb.append(">>\n");
}
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFactory.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFactory.java Thu Jan 10 11:58:23 2008
@@ -849,6 +849,17 @@
}
/**
+ * Make a names dictionary (the /PageLabels object).
+ * @return the new PDFPageLabels object
+ */
+ public PDFPageLabels makePageLabels() {
+ PDFPageLabels pageLabels = new PDFPageLabels();
+ getDocument().assignObjectNumber(pageLabels);
+ getDocument().addTrailerObject(pageLabels);
+ return pageLabels;
+ }
+
+ /**
* Make a the head object of the name dictionary (the /Dests object).
*
* @param destinationList a list of PDFDestination instances
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFFilterList.java Thu Jan 10 11:58:23 2008
@@ -335,9 +335,9 @@
}
if (array.length() > 0 & needParmsEntry) {
if (array.length() > 1) {
- dict.put("DecodeParams", array);
+ dict.put("DecodeParms", array);
} else {
- dict.put("DecodeParams", array.get(0));
+ dict.put("DecodeParms", array.get(0));
}
}
}
Propchange: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFNames.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFRoot.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFRoot.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFRoot.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/pdf/PDFRoot.java Thu Jan 10 11:58:23 2008
@@ -19,12 +19,10 @@
package org.apache.fop.pdf;
-import java.util.List;
-
/**
- * class representing a Root (/Catalog) object
+ * Class representing a Root (/Catalog) object.
*/
-public class PDFRoot extends PDFObject {
+public class PDFRoot extends PDFDictionary {
/**
* Use no page mode setting, default
@@ -46,27 +44,13 @@
*/
public static final int PAGEMODE_FULLSCREEN = 3;
- /**
- * the /Pages object that is root of the Pages hierarchy
- */
- protected PDFPages rootPages;
-
- /**
- * Root outline object
- */
- private PDFOutline outline;
-
- /** Optional Metadata object */
- private PDFMetadata metadata;
+ private static final PDFName[] PAGEMODE_NAMES = new PDFName[] {
+ new PDFName("UseNone"),
+ new PDFName("UseOutlines"),
+ new PDFName("UseThumbs"),
+ new PDFName("FullScreen"),
+ };
- /** The array of OutputIntents */
- private List outputIntents;
-
- /** the /Dests object, if this PDF has a Names Dictionary */
- private PDFNames names;
-
- private int pageMode = PAGEMODE_USENONE;
-
/**
* create a Root (/Catalog) object. NOTE: The PDFRoot
* object must be created before the PDF document is
@@ -80,25 +64,45 @@
public PDFRoot(int objnum, PDFPages pages) {
super();
setObjectNumber(objnum);
+ put("Type", new PDFName("Catalog"));
setRootPages(pages);
}
/**
* Set the page mode for the PDF document.
*
- * @param mode the page mode
+ * @param mode the page mode (one of PAGEMODE_*)
*/
public void setPageMode(int mode) {
- pageMode = mode;
+ put("PageMode", PAGEMODE_NAMES[mode]);
}
/**
+ * Returns the currently active /PageMode.
+ * @return the /PageMode (one of PAGEMODE_*)
+ */
+ public int getPageMode() {
+ PDFName mode = (PDFName)get("PageMode");
+ if (mode != null) {
+ for (int i = 0; i < PAGEMODE_NAMES.length; i++) {
+ if (PAGEMODE_NAMES[i].equals(mode)) {
+ return i;
+ }
+ }
+ throw new IllegalStateException("Unknown /PageMode encountered: " + mode);
+ } else {
+ return PAGEMODE_USENONE;
+ }
+ }
+
+ /**
* add a /Page object to the root /Pages object
*
* @param page the /Page object to add
*/
public void addPage(PDFPage page) {
- this.rootPages.addPage(page);
+ PDFPages pages = getRootPages();
+ pages.addPage(page);
}
/**
@@ -107,16 +111,50 @@
* @param pages the /Pages object to set as root
*/
public void setRootPages(PDFPages pages) {
- this.rootPages = pages;
+ put("Pages", pages.makeReference());
}
/**
+ * Returns the /PageLabels object.
+ * @return the /PageLabels object if set, null otherwise.
+ * @since PDF 1.3
+ */
+ public PDFPages getRootPages() {
+ PDFReference ref = (PDFReference)get("Pages");
+ return (ref != null ? (PDFPages)ref.getObject() : null);
+ }
+
+ /**
+ * Sets the /PageLabels object.
+ * @param pageLabels the /PageLabels object
+ */
+ public void setPageLabels(PDFPageLabels pageLabels) {
+ put("PageLabels", pageLabels.makeReference());
+ }
+
+ /**
+ * Returns the /PageLabels object.
+ * @return the /PageLabels object if set, null otherwise.
+ * @since PDF 1.3
+ */
+ public PDFPageLabels getPageLabels() {
+ PDFReference ref = (PDFReference)get("PageLabels");
+ return (ref != null ? (PDFPageLabels)ref.getObject() : null);
+ }
+
+ /**
* Set the root outline for the PDF document.
*
* @param out the root PDF Outline
*/
public void setRootOutline(PDFOutline out) {
- outline = out;
+ put("Outlines", out.makeReference());
+
+ //Set /PageMode to /UseOutlines by default if no other mode has been set
+ PDFName mode = (PDFName)get("PageMode");
+ if (mode == null) {
+ setPageMode(PAGEMODE_USEOUTLINES);
+ }
}
/**
@@ -125,24 +163,27 @@
* @return the root PDF Outline
*/
public PDFOutline getRootOutline() {
- return outline;
+ PDFReference ref = (PDFReference)get("Outlines");
+ return (ref != null ? (PDFOutline)ref.getObject() : null);
}
/**
- * Set the Names object.
+ * Set the /Names object.
* @param names the Names object
* @since PDF 1.2
*/
public void setNames(PDFNames names) {
- this.names = names;
+ put("Names", names.makeReference());
}
/**
+ * Returns the /Names object.
* @return the Names object if set, null otherwise.
* @since PDF 1.2
*/
public PDFNames getNames() {
- return this.names;
+ PDFReference ref = (PDFReference)get("Names");
+ return (ref != null ? (PDFNames)ref.getObject() : null);
}
/**
@@ -151,78 +192,44 @@
* @since PDF 1.4
*/
public void setMetadata(PDFMetadata meta) {
- this.metadata = meta;
+ if (getDocumentSafely().getPDFVersion() >= PDFDocument.PDF_VERSION_1_4) {
+ put("Metadata", meta.makeReference());
+ }
}
/**
- * @return the Metadata object if set, null otherwise.
+ * Returns the /Metadata object
+ * @return the /Metadata object if set, null otherwise.
* @since PDF 1.4
*/
public PDFMetadata getMetadata() {
- return this.metadata;
+ PDFReference ref = (PDFReference)get("Metadata");
+ return (ref != null ? (PDFMetadata)ref.getObject() : null);
}
/**
- * Adds an OutputIntent to the PDF
- * @param outputIntent the OutputIntent dictionary
+ * Returns the /OutputIntents array.
+ * @return the /OutputIntents array or null if it doesn't exist
+ * @since PDF 1.4
*/
- public void addOutputIntent(PDFOutputIntent outputIntent) {
- if (this.outputIntents == null) {
- this.outputIntents = new java.util.ArrayList();
- }
- this.outputIntents.add(outputIntent);
+ public PDFArray getOutputIntents() {
+ return (PDFArray)get("OutputIntents");
}
/**
- * {@inheritDoc}
+ * Adds an OutputIntent to the PDF
+ * @param outputIntent the OutputIntent dictionary
+ * @since PDF 1.4
*/
- public String toPDFString() {
- StringBuffer p = new StringBuffer(128);
- p.append(getObjectID());
- p.append("<< /Type /Catalog\n /Pages "
- + this.rootPages.referencePDF()
- + "\n");
- if (outline != null) {
- p.append(" /Outlines " + outline.referencePDF() + "\n");
- p.append(" /PageMode /UseOutlines\n");
- } else {
- switch (pageMode) {
- case PAGEMODE_USEOUTLINES:
- p.append(" /PageMode /UseOutlines\n");
- break;
- case PAGEMODE_USETHUMBS:
- p.append(" /PageMode /UseThumbs\n");
- break;
- case PAGEMODE_FULLSCREEN:
- p.append(" /PageMode /FullScreen\n");
- break;
- case PAGEMODE_USENONE:
- default:
- break;
- }
- }
- if (getDocumentSafely().hasDestinations() && getNames() != null) {
- p.append(" /Names " + getNames().referencePDF() + "\n");
- }
- if (getMetadata() != null
- && getDocumentSafely().getPDFVersion() >= PDFDocument.PDF_VERSION_1_4) {
- p.append(" /Metadata " + getMetadata().referencePDF() + "\n");
- }
- if (this.outputIntents != null
- && this.outputIntents.size() > 0
- && getDocumentSafely().getPDFVersion() >= PDFDocument.PDF_VERSION_1_4) {
- p.append(" /OutputIntents [");
- for (int i = 0, c = this.outputIntents.size(); i < c; i++) {
- PDFOutputIntent outputIntent = (PDFOutputIntent)this.outputIntents.get(i);
- if (i > 0) {
- p.append(" ");
- }
- p.append(outputIntent.referencePDF());
+ public void addOutputIntent(PDFOutputIntent outputIntent) {
+ if (getDocumentSafely().getPDFVersion() >= PDFDocument.PDF_VERSION_1_4) {
+ PDFArray outputIntents = getOutputIntents();
+ if (outputIntents == null) {
+ outputIntents = new PDFArray();
+ put("OutputIntents", outputIntents);
}
- p.append("]\n");
+ outputIntents.add(outputIntent);
}
- p.append(">>\nendobj\n");
- return p.toString();
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRendererConfigurator.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/PrintRendererConfigurator.java Thu Jan 10 11:58:23 2008
@@ -118,7 +118,7 @@
boolean strict, FontCache fontCache) throws FOPException {
List fontInfoList = new java.util.ArrayList();
- Configuration fonts = cfg.getChild("fonts");
+ Configuration fonts = cfg.getChild("fonts", false);
if (fonts != null) {
long start = 0;
if (log.isDebugEnabled()) {
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPGraphics2D.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/AFPGraphics2D.java Thu Jan 10 11:58:23 2008
@@ -89,13 +89,18 @@
}
/**
- * Creates a new AbstractGraphics2D from an existing instance.
+ * Creates a new AFPGraphics2D from an existing instance.
*
* @param g
- * the AbstractGraphics2D whose properties should be copied
+ * the AFPGraphics2D whose properties should be copied
*/
public AFPGraphics2D(AFPGraphics2D g) {
super(g);
+ this.graphicsObj = g.graphicsObj;
+ this.fallbackTextHandler = g.fallbackTextHandler;
+ this.customTextHandler = g.customTextHandler;
+ this.afpInfo = g.afpInfo;
+ this.afpState = g.afpState;
}
/**
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java Thu Jan 10 11:58:23 2008
@@ -21,11 +21,13 @@
import java.io.Serializable;
-import org.apache.fop.fo.extensions.ExtensionAttachment;
-import org.apache.fop.util.XMLizable;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
+
+import org.apache.xmlgraphics.util.XMLizable;
+
+import org.apache.fop.fo.extensions.ExtensionAttachment;
/**
* This is the pass-through value object for the PostScript extension.
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/ImageSizeParameter.java Thu Jan 10 11:58:23 2008
@@ -38,8 +38,8 @@
* resolution, hsize and vsize.
* @param hresol The horizontal resolution of the image.
* @param vresol The vertical resolution of the image.
- * @param hsize The hsize of the image.
- * @param vsize The vsize of the vsize.
+ * @param hsize The horizontal size of the image.
+ * @param vsize The vertical size of the image.
*/
public ImageSizeParameter(int hresol, int vresol, int hsize, int vsize) {
this.hRes = hresol;
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageOverlay.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageOverlay.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageOverlay.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageOverlay.java Thu Jan 10 11:58:23 2008
@@ -42,12 +42,12 @@
/**
* The x coordinate
*/
- private int xCoor = 0;
+ private int x = 0;
/**
* The y coordinate
*/
- private int yCoor = 0;
+ private int y = 0;
/**
* The orientation
@@ -62,11 +62,9 @@
* @param orientation The orientation
*/
public IncludePageOverlay(String overlayName, int x, int y, int orientation) {
-
super(overlayName);
-
- xCoor = x;
- yCoor = y;
+ this.x = x;
+ this.y = y;
setOrientation(orientation);
}
@@ -77,7 +75,6 @@
* The orientation (0,90, 180, 270)
*/
public void setOrientation(int orientation) {
-
if (orientation == 0 || orientation == 90 || orientation == 180
|| orientation == 270) {
this.orientation = orientation;
@@ -85,7 +82,6 @@
throw new IllegalArgumentException(
"The orientation must be one of the values 0, 90, 180, 270");
}
-
}
/**
@@ -101,9 +97,9 @@
data[0] = 0x5A;
// Set the total record length
- byte[] rl1 = BinaryUtils.convert(24, 2); //Ignore first byte
- data[1] = rl1[0];
- data[2] = rl1[1];
+ byte[] len = BinaryUtils.convert(24, 2); //Ignore first byte
+ data[1] = len[0];
+ data[2] = len[1];
// Structured field ID for a IPO
data[3] = (byte) 0xD3;
@@ -115,20 +111,18 @@
data[8] = 0x00; // Reserved
for (int i = 0; i < nameBytes.length; i++) {
-
data[9 + i] = nameBytes[i];
-
}
- byte[] r2 = BinaryUtils.convert(xCoor, 3);
- data[17] = r2[0]; // x coordinate
- data[18] = r2[1];
- data[19] = r2[2];
-
- byte[] r3 = BinaryUtils.convert(yCoor, 3);
- data[20] = r3[0]; // y coordinate
- data[21] = r3[1];
- data[22] = r3[2];
+ byte[] xcoord = BinaryUtils.convert(x, 3);
+ data[17] = xcoord[0]; // x coordinate
+ data[18] = xcoord[1];
+ data[19] = xcoord[2];
+
+ byte[] ycoord = BinaryUtils.convert(y, 3);
+ data[20] = ycoord[0]; // y coordinate
+ data[21] = ycoord[1];
+ data[22] = ycoord[2];
switch (orientation) {
case 90:
@@ -148,9 +142,6 @@
data[24] = 0x00;
break;
}
-
os.write(data);
-
}
-
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageSegment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageSegment.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageSegment.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/IncludePageSegment.java Thu Jan 10 11:58:23 2008
@@ -45,24 +45,24 @@
/**
* The x position where we need to put this object on the page
*/
- private byte[] xCoor;
+ private byte[] x;
/**
* The y position where we need to put this object on the page
*/
- private byte[] yCoor;
+ private byte[] y;
/**
* Constructor for the Include Page Segment
* @param name Name of the page segment
- * @param xVal The x position
- * @param yVal The y position
+ * @param x The x position
+ * @param y The y position
*/
- public IncludePageSegment(String name, int xVal, int yVal) {
+ public IncludePageSegment(String name, int x, int y) {
super(name);
- this.xCoor = BinaryUtils.convert(xVal, 3);
- this.yCoor = BinaryUtils.convert(yVal, 3);
+ this.x = BinaryUtils.convert(x, 3);
+ this.y = BinaryUtils.convert(y, 3);
}
@@ -93,22 +93,17 @@
data[8] = 0x00; // Reserved
for (int i = 0; i < nameBytes.length; i++) {
-
data[9 + i] = nameBytes[i];
-
}
- data[17] = xCoor[0]; // x coordinate
- data[18] = xCoor[1];
- data[19] = xCoor[2];
-
- data[20] = yCoor[0]; // y coordinate
- data[21] = yCoor[1];
- data[22] = yCoor[2];
+ data[17] = x[0]; // x coordinate
+ data[18] = x[1];
+ data[19] = x[2];
+
+ data[20] = y[0]; // y coordinate
+ data[21] = y[1];
+ data[22] = y[2];
os.write(data);
-
}
-
-
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/afp/modca/MapPageOverlay.java Thu Jan 10 11:58:23 2008
@@ -30,7 +30,6 @@
* The Map Page Overlay structured field maps a Resource Local ID to the name of
* a Begin Overlay structured field. A Map Page Overlay structured field may
* contain from one to 254 repeating groups.
- *
*/
public class MapPageOverlay extends AbstractAFPObject {
@@ -68,15 +67,10 @@
log.debug("addOverlay():: adding overlay " + name);
}
- byte[] data;
-
try {
-
- data = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ byte[] data = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
overLays.add(data);
-
} catch (UnsupportedEncodingException usee) {
-
log.error("addOverlay():: UnsupportedEncodingException translating the name "
+ name);
}
@@ -117,7 +111,6 @@
byte olayref = 0x00;
for (int i = 0; i < oLayCount; i++) {
-
olayref = (byte) (olayref + 1);
data[++pos] = 0x00;
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java Thu Jan 10 11:58:23 2008
@@ -68,5 +68,6 @@
log.info("TIFF compression set to " + name);
}
}
+ super.configure(renderer);
}
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java Thu Jan 10 11:58:23 2008
@@ -16,183 +16,23 @@
*/
/* $Id$ */
-
-package org.apache.fop.render.java2d;
-// Java
-import java.awt.Graphics2D;
-import java.util.Map;
-import java.util.Set;
+package org.apache.fop.render.java2d;
import org.apache.fop.fonts.FontMetrics;
-import org.apache.fop.fonts.FontType;
-import org.apache.fop.fonts.Typeface;
-
/**
- * This class implements org.apache.fop.layout.FontMetrics and
- * is added to the hash table in FontInfo. It deferes the
- * actual calculation of the metrics to
- * Java2DFontMetrics. It only keeps the java name and
- * style as member varibles
+ * Adds method to retrieve the actual <tt>java.awt.Font</tt>
+ * for use by <tt>Java2DRenderer</tt>s.
*/
-
-public class FontMetricsMapper extends Typeface implements FontMetrics {
-
- /**
- * This is a Java2DFontMetrics that does the real calculation.
- * It is only one class that dynamically determines the font-size.
- */
- private static Java2DFontMetrics metric = null;
-
- /**
- * The java name of the font.
- * # Make the family name immutable.
- */
- private final String family;
-
- /**
- * The java style of the font.
- * # Make the style immutable.
- */
- private final int style;
-
- /**
- * Constructs a new Font-metrics.
- * @param family the family name of the font (java value)
- * @param style the java type style value of the font
- * @param graphics a Graphics2D object - this is needed so
- * that we can get an instance of java.awt.FontMetrics
- */
- public FontMetricsMapper(String family, int style, Graphics2D graphics) {
- this.family = family;
- this.style = style;
- if (metric == null) {
- metric = new Java2DFontMetrics(graphics);
- }
- }
-
- /** {@inheritDoc} */
- public String getFontName() {
- return family;
- }
-
- /** {@inheritDoc} */
- public String getEmbedFontName() {
- return getFontName();
- }
-
- /** {@inheritDoc} */
- public String getFullName() {
- return getFontName();
- }
-
- /** {@inheritDoc} */
- public Set getFamilyNames() {
- Set s = new java.util.HashSet();
- s.add(this.family);
- return s;
- }
-
- /**
- * {@inheritDoc}
- */
- public FontType getFontType() {
- return FontType.OTHER;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getMaxAscent(int size) {
- return metric.getMaxAscent(family, style, size);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getAscender(int size) {
- return metric.getAscender(family, style, size);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getCapHeight(int size) {
- return metric.getCapHeight(family, style, size);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getDescender(int size) {
- return metric.getDescender(family, style, size);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getXHeight(int size) {
- return metric.getXHeight(family, style, size);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getWidth(int i, int size) {
- return metric.width(i, family, style, size);
- }
-
-
- /**
- * {@inheritDoc}
- */
- public int[] getWidths() {
- return metric.getWidths(family, style, Java2DFontMetrics.FONT_SIZE);
- }
+public interface FontMetricsMapper extends FontMetrics {
/**
* Gets a Font instance of the Font that this
* FontMetrics describes in the desired size.
* @param size font size
- * @return font with the desired characeristics.
- */
- public java.awt.Font getFont(int size) {
- return metric.getFont(family, style, size);
- }
-
- /**
- * {@inheritDoc}
- */
- public Map getKerningInfo() {
- return java.util.Collections.EMPTY_MAP;
- }
-
- /**
- * {@inheritDoc}
+ * @return font with the desired characteristics.
*/
- public boolean hasKerningInfo() {
- return false;
- }
-
- /** {@inheritDoc} */
- public String getEncoding() {
- return null; //Not applicable to Java2D rendering
- }
-
- /** {@inheritDoc} */
- public char mapChar(char c) {
- return c;
- }
-
- /** {@inheritDoc} */
- public boolean hasChar(char c) {
- return metric.hasChar(family, style, Java2DFontMetrics.FONT_SIZE, c);
- }
-
+ java.awt.Font getFont(int size);
+
}
-
-
-
-
-
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontSetup.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontSetup.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/FontSetup.java Thu Jan 10 11:58:23 2008
@@ -5,9 +5,9 @@
* 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.
@@ -22,14 +22,23 @@
// FOP
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
+import java.util.List;
import java.util.Set;
+import javax.xml.transform.Source;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.apache.fop.fonts.CustomFont;
+import org.apache.fop.fonts.EmbedFontInfo;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.FontLoader;
+import org.apache.fop.fonts.FontResolver;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.fonts.FontUtil;
+import org.apache.fop.fonts.LazyFont;
/**
* Sets up the Java2D/AWT fonts. It is similar to
@@ -41,18 +50,18 @@
/** logging instance */
protected static Log log = LogFactory.getLog(FontSetup.class);
-
+
private static final int LAST_PREDEFINED_FONT_NUMBER = 14;
private static final Set HARDCODED_FONT_NAMES;
-
+
static {
HARDCODED_FONT_NAMES = new java.util.HashSet();
HARDCODED_FONT_NAMES.add("any");
HARDCODED_FONT_NAMES.add("sans-serif");
HARDCODED_FONT_NAMES.add("serif");
HARDCODED_FONT_NAMES.add("monospace");
-
+
HARDCODED_FONT_NAMES.add("Helvetica");
HARDCODED_FONT_NAMES.add("Times");
HARDCODED_FONT_NAMES.add("Courier");
@@ -62,7 +71,7 @@
HARDCODED_FONT_NAMES.add("Times-Roman");
HARDCODED_FONT_NAMES.add("Computer-Modern-Typewriter");
}
-
+
/**
* Sets up the font info object.
*
@@ -70,9 +79,12 @@
* triplets for lookup.
*
* @param fontInfo the font info object to set up
- * @param graphics needed for acces to font metrics
+ * @param configuredFontList of fop config fonts
+ * @param resolver for resolving the font file URI
+ * @param graphics needed for access to font metrics
*/
- public static void setup(FontInfo fontInfo, Graphics2D graphics) {
+ public static void setup(FontInfo fontInfo, List configuredFontList,
+ FontResolver resolver, Graphics2D graphics) {
FontMetricsMapper metric;
int normal, bold, bolditalic, italic;
@@ -87,47 +99,47 @@
italic = java.awt.Font.ITALIC;
bolditalic = java.awt.Font.BOLD + java.awt.Font.ITALIC;
- metric = new FontMetricsMapper("SansSerif", normal, graphics);
+ metric = new SystemFontMetricsMapper("SansSerif", normal, graphics);
// --> goes to F1
fontInfo.addMetrics("F1", metric);
- metric = new FontMetricsMapper("SansSerif", italic, graphics);
+ metric = new SystemFontMetricsMapper("SansSerif", italic, graphics);
// --> goes to F2
fontInfo.addMetrics("F2", metric);
- metric = new FontMetricsMapper("SansSerif", bold, graphics);
+ metric = new SystemFontMetricsMapper("SansSerif", bold, graphics);
// --> goes to F3
fontInfo.addMetrics("F3", metric);
- metric = new FontMetricsMapper("SansSerif", bolditalic, graphics);
+ metric = new SystemFontMetricsMapper("SansSerif", bolditalic, graphics);
// --> goes to F4
fontInfo.addMetrics("F4", metric);
- metric = new FontMetricsMapper("Serif", normal, graphics);
+ metric = new SystemFontMetricsMapper("Serif", normal, graphics);
// --> goes to F5
fontInfo.addMetrics("F5", metric);
- metric = new FontMetricsMapper("Serif", italic, graphics);
+ metric = new SystemFontMetricsMapper("Serif", italic, graphics);
// --> goes to F6
fontInfo.addMetrics("F6", metric);
- metric = new FontMetricsMapper("Serif", bold, graphics);
+ metric = new SystemFontMetricsMapper("Serif", bold, graphics);
// --> goes to F7
fontInfo.addMetrics("F7", metric);
- metric = new FontMetricsMapper("Serif", bolditalic, graphics);
+ metric = new SystemFontMetricsMapper("Serif", bolditalic, graphics);
// --> goes to F8
fontInfo.addMetrics("F8", metric);
- metric = new FontMetricsMapper("MonoSpaced", normal, graphics);
+ metric = new SystemFontMetricsMapper("MonoSpaced", normal, graphics);
// --> goes to F9
fontInfo.addMetrics("F9", metric);
- metric = new FontMetricsMapper("MonoSpaced", italic, graphics);
+ metric = new SystemFontMetricsMapper("MonoSpaced", italic, graphics);
// --> goes to F10
fontInfo.addMetrics("F10", metric);
- metric = new FontMetricsMapper("MonoSpaced", bold, graphics);
+ metric = new SystemFontMetricsMapper("MonoSpaced", bold, graphics);
// --> goes to F11
fontInfo.addMetrics("F11", metric);
- metric = new FontMetricsMapper("MonoSpaced", bolditalic, graphics);
+ metric = new SystemFontMetricsMapper("MonoSpaced", bolditalic, graphics);
// --> goes to F12
fontInfo.addMetrics("F12", metric);
- metric = new FontMetricsMapper("Serif", normal, graphics);
+ metric = new SystemFontMetricsMapper("Serif", normal, graphics);
//"Symbol" doesn't seem to work here, but "Serif" does the job just fine. *shrug*
// --> goes to F13 and F14
fontInfo.addMetrics("F13", metric);
@@ -206,31 +218,32 @@
fontInfo.addFontProperties("F8", "Times Roman", "italic", Font.WEIGHT_BOLD);
fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
"normal", Font.WEIGHT_NORMAL);
-
- configureInstalledAWTFonts(fontInfo, graphics, LAST_PREDEFINED_FONT_NUMBER + 1);
+
+ int lastNum = configureInstalledAWTFonts(fontInfo, graphics, LAST_PREDEFINED_FONT_NUMBER + 1);
+ addConfiguredFonts(fontInfo, configuredFontList, resolver, lastNum++);
}
- private static void configureInstalledAWTFonts(FontInfo fontInfo, Graphics2D graphics,
+ private static int configureInstalledAWTFonts(FontInfo fontInfo, Graphics2D graphics,
int startNumber) {
int num = startNumber;
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
-
+
java.awt.Font[] fonts = env.getAllFonts();
for (int i = 0; i < fonts.length; i++) {
java.awt.Font f = fonts[i];
if (HARDCODED_FONT_NAMES.contains(f.getName())) {
continue; //skip
}
-
+
if (log.isTraceEnabled()) {
- log.trace("AWT Font: " + f.getFontName()
- + ", family: " + f.getFamily()
- + ", PS: " + f.getPSName()
+ log.trace("AWT Font: " + f.getFontName()
+ + ", family: " + f.getFamily()
+ + ", PS: " + f.getPSName()
+ ", Name: " + f.getName()
+ ", Angle: " + f.getItalicAngle()
+ ", Style: " + f.getStyle());
}
-
+
String searchName = FontUtil.stripWhiteSpace(f.getName()).toLowerCase();
String guessedStyle = FontUtil.guessStyle(searchName);
int guessedWeight = FontUtil.guessWeight(searchName);
@@ -239,7 +252,7 @@
String fontKey = "F" + num;
int style = convertToAWTFontStyle(guessedStyle, guessedWeight);
addFontMetricsMapper(fontInfo, f.getName(), fontKey, graphics, style);
-
+
//Register appropriate font triplets matching the font. Two different strategies:
//Example: "Arial Bold", normal, normal
addFontTriplet(fontInfo, f.getName(),
@@ -250,9 +263,69 @@
guessedStyle, guessedWeight, fontKey);
}
}
+ return num;
}
+ /**
+ * Add fonts from configuration file starting with internal name F<num>.
+ *
+ * @param fontInfo the font info object to set up
+ * @param fontList a list of EmbedFontInfo objects
+ * @param num starting index for internal font numbering
+ * @param resolver the font resolver
+ */
+ private static void addConfiguredFonts(FontInfo fontInfo, List fontList, FontResolver resolver, int num) {
+
+ if (fontList == null || fontList.size() < 1) {
+ log.debug("No user configured fonts found.");
+ return;
+ }
+ if (resolver == null) {
+ // Ensure that we have minimal font resolution capabilities
+ resolver = org.apache.fop.fonts.FontSetup
+ .createMinimalFontResolver();
+ }
+ String internalName = null;
+
+ for (int i = 0; i < fontList.size(); i++) {
+
+ EmbedFontInfo configFontInfo = (EmbedFontInfo) fontList.get(i);
+ String fontFile = configFontInfo.getEmbedFile();
+ internalName = "F" + num;
+ num++;
+ try {
+ FontMetricsMapper font = null;
+ String metricsUrl = configFontInfo.getMetricsFile();
+ // If the user specified an XML-based metrics file, we'll use it
+ // Otherwise, calculate metrics directly from the font file.
+ if (metricsUrl != null) {
+ LazyFont fontMetrics = new LazyFont(configFontInfo, resolver);
+ Source fontSource = resolver.resolve(configFontInfo.getEmbedFile());
+ font = new CustomFontMetricsMapper(fontMetrics, fontSource);
+ } else {
+ CustomFont fontMetrics = FontLoader.loadFont(fontFile, resolver);
+ font = new CustomFontMetricsMapper(fontMetrics);
+ }
+
+ fontInfo.addMetrics(internalName, font);
+
+ List triplets = configFontInfo.getFontTriplets();
+ for (int c = 0; c < triplets.size(); c++) {
+ FontTriplet triplet = (FontTriplet) triplets.get(c);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Registering: " + triplet + " under " + internalName);
+ }
+ fontInfo.addFontProperties(internalName, triplet);
+ }
+ } catch (Exception e) {
+ log.warn("Unable to load custom font from file '" + fontFile + "'", e);
+ }
+ }
+ }
+
+
private static void addFontTriplet(FontInfo fontInfo, String fontName, String fontStyle,
int fontWeight, String fontKey) {
FontTriplet triplet = FontInfo.createFontKey(fontName, fontStyle, fontWeight);
@@ -261,7 +334,7 @@
private static void addFontMetricsMapper(FontInfo fontInfo, String family, String fontKey,
Graphics2D graphics, int style) {
- FontMetricsMapper metric = new FontMetricsMapper(family, style, graphics);
+ FontMetricsMapper metric = new SystemFontMetricsMapper(family, style, graphics);
fontInfo.addMetrics(fontKey, metric);
}
@@ -275,6 +348,6 @@
}
return style;
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRenderer.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRenderer.java Thu Jan 10 11:58:23 2008
@@ -179,7 +179,7 @@
//The next line is important to get accurate font metrics!
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
- FontSetup.setup(fontInfo, g);
+ FontSetup.setup(fontInfo, fontList, fontResolver, g);
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java Thu Jan 10 11:58:23 2008
@@ -53,5 +53,6 @@
java2dRenderer.setTransparentPageBackground("true".equalsIgnoreCase(value));
}
}
+ super.configure(renderer);
}
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRenderer.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRenderer.java Thu Jan 10 11:58:23 2008
@@ -48,8 +48,12 @@
import java.util.Map;
import java.util.Stack;
+import org.w3c.dom.Document;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.java2d.GraphicContext;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.area.Area;
@@ -86,8 +90,6 @@
import org.apache.fop.traits.BorderProps;
import org.apache.fop.util.QName;
import org.apache.fop.util.UnitConv;
-import org.apache.xmlgraphics.java2d.GraphicContext;
-import org.w3c.dom.Document;
/**
* Renderer for the PCL 5 printer language. It also uses HP GL/2 for certain graphic elements.
@@ -182,7 +184,7 @@
//The next line is important to get accurate font metrics!
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
- FontSetup.setup(fontInfo, g);
+ FontSetup.setup(fontInfo, fontList, fontResolver, g);
}
/**
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java Thu Jan 10 11:58:23 2008
@@ -20,6 +20,7 @@
package org.apache.fop.render.pcl;
import org.apache.avalon.framework.configuration.Configuration;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.render.PrintRendererConfigurator;
@@ -73,5 +74,6 @@
pclRenderer.setPJLDisabled(cfg.getChild("disable-pjl").getValueAsBoolean(false));
}
+ super.configure(renderer);
}
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pdf/PDFRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pdf/PDFRenderer.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pdf/PDFRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/pdf/PDFRenderer.java Thu Jan 10 11:58:23 2008
@@ -73,6 +73,7 @@
import org.apache.fop.pdf.PDFAnnotList;
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.pdf.PDFConformanceException;
+import org.apache.fop.pdf.PDFDictionary;
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFEncryptionManager;
import org.apache.fop.pdf.PDFEncryptionParams;
@@ -88,6 +89,7 @@
import org.apache.fop.pdf.PDFOutline;
import org.apache.fop.pdf.PDFOutputIntent;
import org.apache.fop.pdf.PDFPage;
+import org.apache.fop.pdf.PDFPageLabels;
import org.apache.fop.pdf.PDFResourceContext;
import org.apache.fop.pdf.PDFResources;
import org.apache.fop.pdf.PDFState;
@@ -715,6 +717,19 @@
page.getPageIndex());
pageReferences.put(page.getKey(), currentPage.referencePDF());
pvReferences.put(page.getKey(), page);
+
+ //Produce page labels
+ PDFPageLabels pageLabels = this.pdfDoc.getRoot().getPageLabels();
+ if (pageLabels == null) {
+ //Set up PageLabels
+ pageLabels = this.pdfDoc.getFactory().makePageLabels();
+ this.pdfDoc.getRoot().setPageLabels(pageLabels);
+ }
+ PDFDictionary dict = new PDFDictionary();
+ dict.put("P", page.getPageNumberString());
+ //TODO If the sequence of generated page numbers were inspected, this could be
+ //expressed in a more space-efficient way
+ pageLabels.getNums().put(page.getPageIndex(), dict);
}
/**
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/PSRenderer.java Thu Jan 10 11:58:23 2008
@@ -35,9 +35,22 @@
import javax.xml.transform.Source;
+import org.w3c.dom.Document;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.PSProcSets;
+import org.apache.xmlgraphics.ps.PSResource;
+import org.apache.xmlgraphics.ps.PSState;
+import org.apache.xmlgraphics.ps.dsc.DSCException;
+import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.area.Area;
@@ -75,14 +88,6 @@
import org.apache.fop.render.ps.extensions.PSSetPageDevice;
import org.apache.fop.render.ps.extensions.PSSetupCode;
import org.apache.fop.util.CharUtilities;
-import org.apache.xmlgraphics.ps.DSCConstants;
-import org.apache.xmlgraphics.ps.PSGenerator;
-import org.apache.xmlgraphics.ps.PSProcSets;
-import org.apache.xmlgraphics.ps.PSResource;
-import org.apache.xmlgraphics.ps.PSState;
-import org.apache.xmlgraphics.ps.dsc.DSCException;
-import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
-import org.w3c.dom.Document;
/**
* Renderer that renders to PostScript.
@@ -152,6 +157,9 @@
/** Whether or not Dublin Core Standard (dsc) compliant output is enforced */
private boolean dscCompliant = true;
+ /** Is used to determine the document's bounding box */
+ private Rectangle2D documentBoundingBox;
+
/** This is a collection holding all document header comments */
private Collection headerComments;
@@ -776,6 +784,9 @@
gen.writeDSCComment(DSCConstants.CREATION_DATE, new Object[] {new java.util.Date()});
gen.writeDSCComment(DSCConstants.LANGUAGE_LEVEL, new Integer(gen.getPSLevel()));
gen.writeDSCComment(DSCConstants.PAGES, new Object[] {DSCConstants.ATEND});
+ gen.writeDSCComment(DSCConstants.BBOX, DSCConstants.ATEND);
+ gen.writeDSCComment(DSCConstants.HIRES_BBOX, DSCConstants.ATEND);
+ this.documentBoundingBox = new Rectangle2D.Double();
gen.writeDSCComment(DSCConstants.DOCUMENT_SUPPLIED_RESOURCES,
new Object[] {DSCConstants.ATEND});
if (headerComments != null) {
@@ -833,6 +844,8 @@
footerComments.clear();
}
gen.writeDSCComment(DSCConstants.PAGES, new Integer(this.currentPageNumber));
+ new DSCCommentBoundingBox(this.documentBoundingBox).generate(gen);
+ new DSCCommentHiResBoundingBox(this.documentBoundingBox).generate(gen);
gen.getResourceTracker().writeResources(false, gen);
gen.writeDSCComment(DSCConstants.EOF);
gen.flush();
@@ -863,7 +876,8 @@
try {
try {
ResourceHandler.process(this.userAgent, in, this.outputStream,
- this.fontInfo, resTracker, this.formResources, this.currentPageNumber);
+ this.fontInfo, resTracker, this.formResources,
+ this.currentPageNumber, this.documentBoundingBox);
this.outputStream.flush();
} catch (DSCException e) {
throw new RuntimeException(e.getMessage());
@@ -1031,7 +1045,9 @@
log.error(e.getMessage());
}
final Integer zero = new Integer(0);
+ Rectangle2D pageBoundingBox = new Rectangle2D.Double();
if (rotate) {
+ pageBoundingBox.setRect(0, 0, pageHeight, pageWidth);
gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] {
zero, zero, new Long(Math.round(pageHeight)),
new Long(Math.round(pageWidth)) });
@@ -1040,6 +1056,7 @@
new Double(pageWidth) });
gen.writeDSCComment(DSCConstants.PAGE_ORIENTATION, "Landscape");
} else {
+ pageBoundingBox.setRect(0, 0, pageWidth, pageHeight);
gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] {
zero, zero, new Long(Math.round(pageWidth)),
new Long(Math.round(pageHeight)) });
@@ -1051,6 +1068,7 @@
"Portrait");
}
}
+ this.documentBoundingBox.add(pageBoundingBox);
gen.writeDSCComment(DSCConstants.PAGE_RESOURCES,
new Object[] {DSCConstants.ATEND});
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/ResourceHandler.java Thu Jan 10 11:58:23 2008
@@ -19,6 +19,7 @@
package org.apache.fop.render.ps;
+import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -26,10 +27,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.image.FopImage;
-import org.apache.fop.image.ImageFactory;
import org.apache.xmlgraphics.ps.DSCConstants;
import org.apache.xmlgraphics.ps.PSGenerator;
import org.apache.xmlgraphics.ps.dsc.DSCException;
@@ -39,8 +36,10 @@
import org.apache.xmlgraphics.ps.dsc.DefaultNestedDocumentHandler;
import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
import org.apache.xmlgraphics.ps.dsc.events.DSCComment;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentDocumentNeededResources;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentDocumentSuppliedResources;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentLanguageLevel;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage;
import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages;
@@ -49,6 +48,11 @@
import org.apache.xmlgraphics.ps.dsc.events.PostScriptComment;
import org.apache.xmlgraphics.ps.dsc.tools.DSCTools;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.image.FopImage;
+import org.apache.fop.image.ImageFactory;
+
/**
* This class is used when two-pass production is used to generate the PostScript file (setting
* "optimize-resources"). It uses the DSC parser from XML Graphics Commons to go over the
@@ -67,11 +71,14 @@
* @param resTracker the resource tracker to use
* @param formResources Contains all forms used by this document (maintained by PSRenderer)
* @param pageCount the number of pages (given here because PSRenderer writes an "(atend)")
+ * @param documentBoundingBox the document's bounding box
+ * (given here because PSRenderer writes an "(atend)")
* @throws DSCException If there's an error in the DSC structure of the PS file
* @throws IOException In case of an I/O error
*/
public static void process(FOUserAgent userAgent, InputStream in, OutputStream out,
- FontInfo fontInfo, ResourceTracker resTracker, Map formResources, int pageCount)
+ FontInfo fontInfo, ResourceTracker resTracker, Map formResources,
+ int pageCount, Rectangle2D documentBoundingBox)
throws DSCException, IOException {
DSCParser parser = new DSCParser(in);
PSGenerator gen = new PSGenerator(out);
@@ -86,6 +93,8 @@
{
//We rewrite those as part of the processing
filtered.add(DSCConstants.PAGES);
+ filtered.add(DSCConstants.BBOX);
+ filtered.add(DSCConstants.HIRES_BBOX);
filtered.add(DSCConstants.DOCUMENT_NEEDED_RESOURCES);
filtered.add(DSCConstants.DOCUMENT_SUPPLIED_RESOURCES);
}
@@ -109,6 +118,8 @@
//Set number of pages
DSCCommentPages pages = new DSCCommentPages(pageCount);
pages.generate(gen);
+ new DSCCommentBoundingBox(documentBoundingBox).generate(gen);
+ new DSCCommentHiResBoundingBox(documentBoundingBox).generate(gen);
PSFontUtils.determineSuppliedFonts(resTracker, fontInfo, fontInfo.getUsedFonts());
registerSuppliedForms(resTracker, formResources);
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSExtensionAttachment.java Thu Jan 10 11:58:23 2008
@@ -19,11 +19,13 @@
package org.apache.fop.render.ps.extensions;
-import org.apache.fop.fo.extensions.ExtensionAttachment;
-import org.apache.fop.util.XMLizable;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
+
+import org.apache.xmlgraphics.util.XMLizable;
+
+import org.apache.fop.fo.extensions.ExtensionAttachment;
/**
* This is the pass-through value object for the PostScript extension.
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/ps/extensions/PSSetPageDevice.java Thu Jan 10 11:58:23 2008
@@ -96,7 +96,7 @@
* Generates SAX events representing the object's state.
* @param handler ContentHandler instance to send the SAX events to
* @throws SAXException if there's a problem generating the SAX events
- * @see org.apache.fop.util.XMLizable#toSAX(org.xml.sax.ContentHandler)
+ * @see org.apache.xmlgraphics.util.XMLizable#toSAX(org.xml.sax.ContentHandler)
*/
public void toSAX(ContentHandler handler) throws SAXException {
AttributesImpl atts = new AttributesImpl();
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFHandler.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/rtf/RTFHandler.java Thu Jan 10 11:58:23 2008
@@ -199,7 +199,8 @@
log.warn("Using default simple-page-master from page-sequence-master...");
PageSequenceMaster master
= pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(reference);
- this.pagemaster = master.getNextSimplePageMaster(false, false, false, false);
+ this.pagemaster = master.getNextSimplePageMaster(
+ false, false, false, false, false);
}
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/render/xml/XMLRenderer.java Thu Jan 10 11:58:23 2008
@@ -41,7 +41,8 @@
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.helpers.AttributesImpl;
-import org.apache.fop.util.QName;
+import org.apache.xmlgraphics.util.XMLizable;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
@@ -51,21 +52,22 @@
import org.apache.fop.area.Block;
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.BodyRegion;
+import org.apache.fop.area.BookmarkData;
import org.apache.fop.area.CTM;
+import org.apache.fop.area.DestinationData;
import org.apache.fop.area.Footnote;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.MainReference;
import org.apache.fop.area.NormalFlow;
import org.apache.fop.area.OffDocumentExtensionAttachment;
import org.apache.fop.area.OffDocumentItem;
-import org.apache.fop.area.BookmarkData;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.RegionReference;
import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.Span;
import org.apache.fop.area.Trait;
-import org.apache.fop.area.Trait.InternalLink;
import org.apache.fop.area.Trait.Background;
+import org.apache.fop.area.Trait.InternalLink;
import org.apache.fop.area.inline.Container;
import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Image;
@@ -87,7 +89,7 @@
import org.apache.fop.render.RendererContext;
import org.apache.fop.render.XMLHandler;
import org.apache.fop.util.ColorUtil;
-import org.apache.fop.util.XMLizable;
+import org.apache.fop.util.QName;
/**
* Renderer that renders areas to XML for debugging purposes.
@@ -419,6 +421,8 @@
public void processOffDocumentItem(OffDocumentItem oDI) {
if (oDI instanceof BookmarkData) {
renderBookmarkTree((BookmarkData) oDI);
+ } else if (oDI instanceof DestinationData) {
+ renderDestination((DestinationData) oDI);
} else if (oDI instanceof OffDocumentExtensionAttachment) {
ExtensionAttachment attachment = ((OffDocumentExtensionAttachment)oDI).getAttachment();
if (extensionAttachments == null) {
@@ -466,8 +470,23 @@
}
/**
- * {@inheritDoc}
+ * Renders a DestinationData object (named destination)
+ * @param destination the destination object
*/
+ protected void renderDestination(DestinationData destination) {
+ if (destination.getWhenToProcess() == OffDocumentItem.END_OF_DOC) {
+ endPageSequence();
+ }
+ atts.clear();
+ PageViewport pv = destination.getPageViewport();
+ String pvKey = pv == null ? null : pv.getKey();
+ addAttribute("internal-link",
+ InternalLink.makeXMLAttribute(pvKey, destination.getIDRef()));
+ startElement("destination", atts);
+ endElement("destination");
+ }
+
+ /** {@inheritDoc} */
public void startRenderer(OutputStream outputStream)
throws IOException {
log.debug("Rendering areas to Area Tree XML");
@@ -524,7 +543,9 @@
addAttribute("key", page.getKey());
addAttribute("nr", page.getPageNumber());
addAttribute("formatted-nr", page.getPageNumberString());
- addAttribute("simple-page-master-name", page.getSimplePageMasterName());
+ if (page.getSimplePageMasterName() != null) {
+ addAttribute("simple-page-master-name", page.getSimplePageMasterName());
+ }
if (page.isBlank()) {
addAttribute("blank", "true");
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/util/XMLizable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/util/XMLizable.java?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/util/XMLizable.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/util/XMLizable.java Thu Jan 10 11:58:23 2008
@@ -25,20 +25,11 @@
* src/java/org/apache/excalibur/xml/sax/XMLizable.java
*/
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
/**
* This interface can be implemented by classes willing to provide an XML representation
* of their current state as SAX events.
+ * @deprecated Use the interface in Apache XML Graphics Commons instead.
*/
-public interface XMLizable {
-
- /**
- * Generates SAX events representing the object's state.
- * @param handler ContentHandler instance to send the SAX events to
- * @throws SAXException if there's a problem generating the SAX events
- */
- void toSAX(ContentHandler handler) throws SAXException;
+public interface XMLizable extends org.apache.xmlgraphics.util.XMLizable {
}
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/status.xml?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/status.xml Thu Jan 10 11:58:23 2008
@@ -28,7 +28,27 @@
<changes>
<release version="FOP Trunk">
- <action context="Code" dev="AC" type="add">
+ <action context="Code" dev="JM" type="add">
+ PostScript output now generates the bounding box DSC comments for the whole document.
+ </action>
+ <action context="Code" dev="JM" type="add">
+ Added support for PDF page labels.
+ </action>
+ <action context="Code" dev="JM" type="add" fixes-bug="44176" due-to="Patrick Jaromin">
+ Added support for custom fonts in Java2DRenderer and derived renderers.
+ </action>
+ <action context="Code" dev="JM" type="add">
+ Added new extension element: fox:external-document. It allows to add whole documents
+ such as multi-page TIFF images to be inserted as peers to a page-sequence. Each image
+ will make up an entire page. See the documentation for details.
+ </action>
+ <action context="Code" dev="JM" type="add">
+ Added support for scale-down-to-fit and scale-up-to-fit (introduced in XSL 1.1).
+ </action>
+ <action context="Code" dev="VH" type="fix" fixes-bug="43633">
+ Bugfix: content of a row with zero height overriding the previous row
+ </action>
+ <action context="Code" dev="AC" importance="high" type="add">
Added SVG support for AFP (GOCA).
</action>
<action context="Code" dev="JM" type="fix" fixes-bug="37993">
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution.xml Thu Jan 10 11:58:23 2008
@@ -166,6 +166,30 @@
</fo:table-body>
</fo:table>
+ <!-- table 3 -->
+ <fo:block space-before="10pt" space-after="10pt">Between tables</fo:block>
+ <fo:table table-layout="fixed" width="200pt" border-collapse="collapse">
+ <fo:table-column column-width="proportional-column-width(1)"
+ border="6pt solid blue"/>
+ <fo:table-column column-width="proportional-column-width(1)"
+ border="8pt solid red"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell number-columns-spanned="2" border="1pt solid black">
+ <fo:block>Cell 1.1</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <fo:table-row>
+ <fo:table-cell border="1pt solid black">
+ <fo:block>Cell 2.1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell border="1pt solid black">
+ <fo:block>Cell 2.2</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+
<fo:block>After the tables</fo:block>
</fo:flow>
</fo:page-sequence>
@@ -332,6 +356,27 @@
<eval expected="(solid,#ffff00,14000,collapse-outer)" xpath="//flow/block[4]/block[22]/@border-after"/>
<eval expected="(solid,#ffff00,1000,collapse-inner)" xpath="//flow/block[4]/block[22]/@border-start"/>
<eval expected="(solid,#000000,10000,collapse-outer)" xpath="//flow/block[4]/block[22]/@border-end"/>
+
+ <!-- table 3 -->
+ <!-- cell 1.1 -->
+ <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[1]/@border-before"/>
+ <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[1]/@border-after"/>
+ <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[1]/@border-start"/>
+ <eval expected="" xpath="//flow/block[6]/block[1]/@border-end"/>
+ <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[2]/@border-before"/>
+ <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[2]/@border-after"/>
+ <eval expected="" xpath="//flow/block[6]/block[2]/@border-start"/>
+ <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[2]/@border-end"/>
+ <!-- cell 2.1 -->
+ <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[4]/@border-before"/>
+ <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[4]/@border-after"/>
+ <eval expected="(solid,#0000ff,6000,collapse-outer)" xpath="//flow/block[6]/block[4]/@border-start"/>
+ <eval expected="(solid,#ff0000,8000,collapse-inner)" xpath="//flow/block[6]/block[4]/@border-end"/>
+ <!-- cell 2.2 -->
+ <eval expected="(solid,#000000,1000,collapse-inner)" xpath="//flow/block[6]/block[5]/@border-before"/>
+ <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[5]/@border-after"/>
+ <eval expected="(solid,#ff0000,8000,collapse-inner)" xpath="//flow/block[6]/block[5]/@border-start"/>
+ <eval expected="(solid,#ff0000,8000,collapse-outer)" xpath="//flow/block[6]/block[5]/@border-end"/>
</checks>
</testcase>
Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml?rev=610906&r1=610905&r2=610906&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/test/layoutengine/standard-testcases/table_border-collapse_collapse_resolution_no-col.xml Thu Jan 10 11:58:23 2008
@@ -20,7 +20,8 @@
<!--
NOTE: this test is a copy of table_border-collapse_collapse_resolution.xml, with all of the
fo:table-column elements removed. The checks for the borders in the second column of the first
- table have been changed accordingly (no more column which plays in the resolution).
+ table have been changed accordingly (no more column which plays in the resolution), and the third
+ table has been removed (not applicable when there are no columns).
-->
<testcase>
<info>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org