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 vh...@apache.org on 2012/04/05 18:20:17 UTC
svn commit: r1309921 [11/42] - in
/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript: ./ examples/embedding/
examples/embedding/java/embedding/ examples/embedding/java/embedding/atxml/
examples/embedding/java/embedding/tools/ examples/plan/src/org/apa...
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/PageViewport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/PageViewport.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/PageViewport.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/PageViewport.java Thu Apr 5 16:19:19 2012
@@ -25,7 +25,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -33,8 +32,15 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.flow.Marker;
import org.apache.fop.fo.pagination.SimplePageMaster;
+import org.apache.fop.traits.WritingModeTraitsGetter;
+
+import static org.apache.fop.fo.Constants.EN_FIC;
+import static org.apache.fop.fo.Constants.EN_FSWP;
+import static org.apache.fop.fo.Constants.EN_LEWP;
+import static org.apache.fop.fo.Constants.EN_LSWP;
+import static org.apache.fop.fo.Constants.FO_REGION_BODY;
/**
* Page viewport that specifies the viewport area and holds the page contents.
@@ -63,26 +69,24 @@ public class PageViewport extends AreaTr
private transient PageSequence pageSequence;
- // list of id references and the rectangle on the page
- //private Map idReferences = null;
-
// set of IDs that appear first (or exclusively) on this page:
- private Set idFirsts = new java.util.HashSet();
+ private Set<String> idFirsts = new java.util.HashSet<String>();
// this keeps a list of currently unresolved areas or extensions
// once an idref is resolved it is removed
// when this is empty the page can be rendered
- private Map unresolvedIDRefs = new java.util.HashMap();
+ private Map<String, List<Resolvable>> unresolvedIDRefs
+ = new java.util.HashMap<String, List<Resolvable>>();
- private Map pendingResolved = null;
+ private Map<String, List<PageViewport>> pendingResolved = null;
// hashmap of markers for this page
// start and end are added by the fo that contains the markers
- private Map markerFirstStart = null;
- private Map markerLastStart = null;
- private Map markerFirstAny = null;
- private Map markerLastEnd = null;
- private Map markerLastAny = null;
+ private Map<String, Marker> markerFirstStart = null;
+ private Map<String, Marker> markerLastStart = null;
+ private Map<String, Marker> markerFirstAny = null;
+ private Map<String, Marker> markerLastEnd = null;
+ private Map<String, Marker> markerLastAny = null;
/**
* logging instance
@@ -254,8 +258,8 @@ public class PageViewport extends AreaTr
/**
* Add an "ID-first" to this page.
- * This is typically called by the AreaTreeHandler when associating
- * an ID with a PageViewport.
+ * This is typically called by the {@link AreaTreeHandler} when associating
+ * an ID with a {@link PageViewport}.
*
* @param id the id to be registered as first appearing on this page
*/
@@ -277,9 +281,9 @@ public class PageViewport extends AreaTr
/**
* Add an idref to this page.
- * All idrefs found for child areas of this PageViewport are added
- * to unresolvedIDRefs, for subsequent resolution by AreaTreeHandler
- * calls to this object's resolveIDRef().
+ * All idrefs found for child areas of this {@link PageViewport} are added
+ * to unresolvedIDRefs, for subsequent resolution by {@link AreaTreeHandler}
+ * calls to this object's {@code resolveIDRef()}.
*
* @param idref the idref
* @param res the child element of this page that needs this
@@ -287,14 +291,14 @@ public class PageViewport extends AreaTr
*/
public void addUnresolvedIDRef(String idref, Resolvable res) {
if (unresolvedIDRefs == null) {
- unresolvedIDRefs = new HashMap();
+ unresolvedIDRefs = new HashMap<String, List<Resolvable>>();
}
- List list = (List)unresolvedIDRefs.get(idref);
- if (list == null) {
- list = new ArrayList();
- unresolvedIDRefs.put(idref, list);
+ List<Resolvable> pageViewports = unresolvedIDRefs.get(idref);
+ if (pageViewports == null) {
+ pageViewports = new ArrayList<Resolvable>();
+ unresolvedIDRefs.put(idref, pageViewports);
}
- list.add(res);
+ pageViewports.add(res);
}
/**
@@ -312,24 +316,22 @@ public class PageViewport extends AreaTr
*/
public String[] getIDRefs() {
return (unresolvedIDRefs == null) ? null
- : (String[]) unresolvedIDRefs.keySet().toArray(new String[] {});
+ : unresolvedIDRefs.keySet().toArray(
+ new String[unresolvedIDRefs.keySet().size()]);
}
- /**
- * {@inheritDoc}
- */
- public void resolveIDRef(String id, List pages) {
+ /** {@inheritDoc} */
+ public void resolveIDRef(String id, List<PageViewport> pages) {
if (page == null) {
if (pendingResolved == null) {
- pendingResolved = new HashMap();
+ pendingResolved = new HashMap<String, List<PageViewport>>();
}
pendingResolved.put(id, pages);
} else {
if (unresolvedIDRefs != null) {
- List todo = (List)unresolvedIDRefs.get(id);
+ List<Resolvable> todo = unresolvedIDRefs.get(id);
if (todo != null) {
- for (int count = 0; count < todo.size(); count++) {
- Resolvable res = (Resolvable)todo.get(count);
+ for (Resolvable res : todo) {
res.resolveIDRef(id, pages);
}
}
@@ -363,7 +365,7 @@ public class PageViewport extends AreaTr
* @param isfirst if the area being added has is-first trait
* @param islast if the area being added has is-last trait
*/
- public void addMarkers(Map marks, boolean starting,
+ public void addMarkers(Map<String, Marker> marks, boolean starting,
boolean isfirst, boolean islast) {
if (marks == null) {
@@ -380,14 +382,13 @@ public class PageViewport extends AreaTr
if (starting) {
if (isfirst) {
if (markerFirstStart == null) {
- markerFirstStart = new HashMap();
+ markerFirstStart = new HashMap<String, Marker>();
}
if (markerFirstAny == null) {
- markerFirstAny = new HashMap();
+ markerFirstAny = new HashMap<String, Marker>();
}
// first on page: only put in new values, leave current
- for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
+ for (String key : marks.keySet()) {
if (!markerFirstStart.containsKey(key)) {
markerFirstStart.put(key, marks.get(key));
if (log.isTraceEnabled()) {
@@ -404,7 +405,7 @@ public class PageViewport extends AreaTr
}
}
if (markerLastStart == null) {
- markerLastStart = new HashMap();
+ markerLastStart = new HashMap<String, Marker>();
}
// last on page: replace all
markerLastStart.putAll(marks);
@@ -414,11 +415,10 @@ public class PageViewport extends AreaTr
}
} else {
if (markerFirstAny == null) {
- markerFirstAny = new HashMap();
+ markerFirstAny = new HashMap<String, Marker>();
}
// first on page: only put in new values, leave current
- for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
+ for (String key : marks.keySet()) {
if (!markerFirstAny.containsKey(key)) {
markerFirstAny.put(key, marks.get(key));
if (log.isTraceEnabled()) {
@@ -432,7 +432,7 @@ public class PageViewport extends AreaTr
// at the end of the area, register is-last and any areas
if (islast) {
if (markerLastEnd == null) {
- markerLastEnd = new HashMap();
+ markerLastEnd = new HashMap<String, Marker>();
}
// last on page: replace all
markerLastEnd.putAll(marks);
@@ -442,7 +442,7 @@ public class PageViewport extends AreaTr
}
}
if (markerLastAny == null) {
- markerLastAny = new HashMap();
+ markerLastAny = new HashMap<String, Marker>();
}
// last on page: replace all
markerLastAny.putAll(marks);
@@ -462,11 +462,11 @@ public class PageViewport extends AreaTr
* @param pos the position to retrieve
* @return Object the marker found or null
*/
- public Object getMarker(String name, int pos) {
- Object mark = null;
+ public Marker getMarker(String name, int pos) {
+ Marker mark = null;
String posName = null;
switch (pos) {
- case Constants.EN_FSWP:
+ case EN_FSWP:
if (markerFirstStart != null) {
mark = markerFirstStart.get(name);
posName = "FSWP";
@@ -476,13 +476,13 @@ public class PageViewport extends AreaTr
posName = "FirstAny after " + posName;
}
break;
- case Constants.EN_FIC:
+ case EN_FIC:
if (markerFirstAny != null) {
mark = markerFirstAny.get(name);
posName = "FIC";
}
break;
- case Constants.EN_LSWP:
+ case EN_LSWP:
if (markerLastStart != null) {
mark = markerLastStart.get(name);
posName = "LSWP";
@@ -492,7 +492,7 @@ public class PageViewport extends AreaTr
posName = "LastAny after " + posName;
}
break;
- case Constants.EN_LEWP:
+ case EN_LEWP:
if (markerLastEnd != null) {
mark = markerLastEnd.get(name);
posName = "LEWP";
@@ -503,7 +503,7 @@ public class PageViewport extends AreaTr
}
break;
default:
- throw new RuntimeException();
+ assert false;
}
if (log.isTraceEnabled()) {
log.trace("page " + pageNumberString + ": " + "Retrieving marker " + name
@@ -550,10 +550,8 @@ public class PageViewport extends AreaTr
page = (Page) in.readObject();
unresolvedIDRefs = page.getUnresolvedReferences();
if (unresolvedIDRefs != null && pendingResolved != null) {
- for (Iterator iter = pendingResolved.keySet().iterator();
- iter.hasNext();) {
- String id = (String) iter.next();
- resolveIDRef(id, (List)pendingResolved.get(id));
+ for (String id : pendingResolved.keySet()) {
+ resolveIDRef(id, pendingResolved.get(id));
}
pendingResolved = null;
}
@@ -577,9 +575,8 @@ public class PageViewport extends AreaTr
page = null;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer(64);
sb.append("PageViewport: page=");
@@ -602,8 +599,7 @@ public class PageViewport extends AreaTr
* @return BodyRegion object
*/
public BodyRegion getBodyRegion() {
- return (BodyRegion) getPage().getRegionViewport(
- Constants.FO_REGION_BODY).getRegionReference();
+ return (BodyRegion) getPage().getRegionViewport(FO_REGION_BODY).getRegionReference();
}
/**
@@ -660,4 +656,14 @@ public class PageViewport extends AreaTr
return getPage().getRegionViewport(id).getRegionReference();
}
+ /**
+ * Sets the writing mode traits for the page associated with this viewport.
+ * @param wmtg a WM traits getter
+ */
+ public void setWritingModeTraits(WritingModeTraitsGetter wmtg) {
+ if ( page != null ) {
+ page.setWritingModeTraits(wmtg);
+ }
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionReference.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionReference.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionReference.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionReference.java Thu Apr 5 16:19:19 2012
@@ -33,16 +33,14 @@ public class RegionReference extends Are
private static final long serialVersionUID = -298980963268244238L;
- /** Reference to the region FO. */
- //protected Region regionFO;
private int regionClass;
private String regionName;
private CTM ctm;
// the list of block areas from the static flow
- private ArrayList blocks = new ArrayList();
+ private ArrayList<Area> blocks = new ArrayList<Area>();
- /** the parent RegionViewport for this object */
+ /** the parent {@link RegionViewport} for this object */
protected RegionViewport regionViewport;
/**
@@ -70,6 +68,7 @@ public class RegionReference extends Are
}
/** {@inheritDoc} */
+ @Override
public void addChildArea(Area child) {
blocks.add(child);
}
@@ -108,7 +107,7 @@ public class RegionReference extends Are
*
* @return the list of blocks in this region
*/
- public List getBlocks() {
+ public List<Area> getBlocks() {
return blocks;
}
@@ -145,11 +144,12 @@ public class RegionReference extends Are
RegionReference rr = new RegionReference(regionClass, regionName, regionViewport);
rr.ctm = ctm;
rr.setIPD(getIPD());
- rr.blocks = (ArrayList)blocks.clone();
+ rr.blocks = (ArrayList<Area>)blocks.clone();
return rr;
}
/** {@inheritDoc} */
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
sb.append(" {regionName=").append(regionName);
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionViewport.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionViewport.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionViewport.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RegionViewport.java Thu Apr 5 16:19:19 2012
@@ -19,17 +19,20 @@
package org.apache.fop.area;
+import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.util.HashMap;
+import org.apache.fop.traits.WritingModeTraitsGetter;
+
/**
* Region Viewport area.
* This object represents the region-viewport-area. It has a
* region-reference-area as its child. These areas are described
* in the fo:region-body description in the XSL Recommendation.
*/
-public class RegionViewport extends Area implements Cloneable {
+public class RegionViewport extends Area implements Cloneable, Viewport {
private static final long serialVersionUID = 505781815165102572L;
@@ -75,11 +78,20 @@ public class RegionViewport extends Area
clip = c;
}
- /** @return true if the viewport should be clipped. */
- public boolean isClip() {
+ /** {@inheritDoc} */
+ public boolean hasClip() {
return this.clip;
}
+ /** {@inheritDoc} */
+ public Rectangle getClipRectangle() {
+ if (clip) {
+ return new Rectangle(getIPD(), getBPD());
+ } else {
+ return null;
+ }
+ }
+
/**
* Get the view area of this viewport.
*
@@ -96,7 +108,7 @@ public class RegionViewport extends Area
out.writeFloat((float) viewArea.getWidth());
out.writeFloat((float) viewArea.getHeight());
out.writeBoolean(clip);
- out.writeObject(props);
+ out.writeObject(traits);
out.writeObject(regionReference);
}
@@ -105,7 +117,7 @@ public class RegionViewport extends Area
viewArea = new Rectangle2D.Float(in.readFloat(), in.readFloat(),
in.readFloat(), in.readFloat());
clip = in.readBoolean();
- props = (HashMap)in.readObject();
+ traits = (HashMap)in.readObject();
setRegionReference((RegionReference) in.readObject());
}
@@ -118,13 +130,25 @@ public class RegionViewport extends Area
public Object clone() {
RegionViewport rv = new RegionViewport((Rectangle2D)viewArea.clone());
rv.regionReference = (RegionReference)regionReference.clone();
- if (props != null) {
- rv.props = new HashMap(props);
+ if (traits != null) {
+ rv.traits = new HashMap(traits);
}
if (foreignAttributes != null) {
rv.foreignAttributes = new HashMap(foreignAttributes);
}
return rv;
}
+
+ /**
+ * Sets the writing mode traits for the region reference of
+ * this region viewport
+ * @param wmtg a WM traits getter
+ */
+ public void setWritingModeTraits(WritingModeTraitsGetter wmtg) {
+ if (regionReference != null) {
+ regionReference.setWritingModeTraits(wmtg);
+ }
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RenderPagesModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RenderPagesModel.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RenderPagesModel.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/RenderPagesModel.java Thu Apr 5 16:19:19 2012
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import org.xml.sax.SAXException;
@@ -50,9 +51,10 @@ public class RenderPagesModel extends Ar
/**
* Pages that have been prepared but not rendered yet.
*/
- protected List/*<PageViewport>*/ prepared = new java.util.ArrayList/*<PageViewport>*/();
- private List/*<OffDocumentItem>*/ pendingODI = new java.util.ArrayList/*<OffDocumentItem>*/();
- private List/*<OffDocumentItem>*/ endDocODI = new java.util.ArrayList/*<OffDocumentItem>*/();
+ protected List<PageViewport> prepared = new java.util.ArrayList<PageViewport>();
+
+ private List<OffDocumentItem> pendingODI = new java.util.ArrayList<OffDocumentItem>();
+ private List<OffDocumentItem> endDocODI = new java.util.ArrayList<OffDocumentItem>();
/**
* Create a new render pages model with the given renderer.
@@ -82,7 +84,13 @@ public class RenderPagesModel extends Ar
}
}
+ @Override
+ public void setDocumentLocale(Locale locale) {
+ renderer.setDocumentLocale(locale);
+ }
+
/** {@inheritDoc} */
+ @Override
public void startPageSequence(PageSequence pageSequence) {
super.startPageSequence(pageSequence);
if (renderer.supportsOutOfOrder()) {
@@ -98,6 +106,7 @@ public class RenderPagesModel extends Ar
* the page is added to a queue.
* @param page the page to add to the model
*/
+ @Override
public void addPage(PageViewport page) {
super.addPage(page);
@@ -152,14 +161,15 @@ public class RenderPagesModel extends Ar
* false if the renderer doesn't support out of order
* rendering and there are pending pages
*/
- protected boolean checkPreparedPages(PageViewport newPageViewport, boolean
- renderUnresolved) {
+ protected boolean checkPreparedPages(PageViewport newPageViewport,
+ boolean renderUnresolved) {
+
for (Iterator iter = prepared.iterator(); iter.hasNext();) {
PageViewport pageViewport = (PageViewport)iter.next();
if (pageViewport.isResolved() || renderUnresolved) {
if (!renderer.supportsOutOfOrder()
&& pageViewport.getPageSequence().isFirstPage(pageViewport)) {
- renderer.startPageSequence(getCurrentPageSequence());
+ renderer.startPageSequence(pageViewport.getPageSequence());
}
renderPage(pageViewport);
pageViewport.clear();
@@ -183,11 +193,11 @@ public class RenderPagesModel extends Ar
renderer.renderPage(pageViewport);
if (!pageViewport.isResolved()) {
String[] idrefs = pageViewport.getIDRefs();
- for (int count = 0; count < idrefs.length; count++) {
+ for (String idref : idrefs) {
AreaEventProducer eventProducer = AreaEventProducer.Provider.get(
renderer.getUserAgent().getEventBroadcaster());
eventProducer.unresolvedIDReferenceOnPage(this,
- pageViewport.getPageNumberString(), idrefs[count]);
+ pageViewport.getPageNumberString(), idref);
}
}
} catch (Exception e) {
@@ -214,9 +224,8 @@ public class RenderPagesModel extends Ar
prepared.add(page);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
+ @Override
public void handleOffDocumentItem(OffDocumentItem oDI) {
switch(oDI.getWhenToProcess()) {
case OffDocumentItem.IMMEDIATELY:
@@ -233,9 +242,8 @@ public class RenderPagesModel extends Ar
}
}
- private void processOffDocumentItems(List list) {
- for (int count = 0; count < list.size(); count++) {
- OffDocumentItem oDI = (OffDocumentItem)list.get(count);
+ private void processOffDocumentItems(List<OffDocumentItem> list) {
+ for (OffDocumentItem oDI : list) {
renderer.processOffDocumentItem(oDI);
}
}
@@ -244,6 +252,7 @@ public class RenderPagesModel extends Ar
* End the document. Render any end document OffDocumentItems
* {@inheritDoc}
*/
+ @Override
public void endDocument() throws SAXException {
// render any pages that had unresolved ids
checkPreparedPages(null, true);
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Resolvable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Resolvable.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Resolvable.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Resolvable.java Thu Apr 5 16:19:19 2012
@@ -59,5 +59,5 @@ public interface Resolvable {
* @param pages the list of PageViewports with the given ID
*
*/
- void resolveIDRef(String id, List pages);
+ void resolveIDRef(String id, List<PageViewport> pages);
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Span.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Span.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Span.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Span.java Thu Apr 5 16:19:19 2012
@@ -19,8 +19,12 @@
package org.apache.fop.area;
+import java.util.Iterator;
import java.util.List;
+import org.apache.fop.fo.Constants;
+import org.apache.fop.traits.WritingModeTraitsGetter;
+
/**
* The span-reference-area.
* This is a block-area with 0 border and padding that is stacked
@@ -34,7 +38,7 @@ public class Span extends Area {
private static final long serialVersionUID = -5551430053660081549L;
// the list of flow reference areas in this span area
- private List flowAreas;
+ private List<NormalFlow> flowAreas;
private int colCount;
private int colGap;
private int colWidth; // width for each normal flow, calculated value
@@ -60,7 +64,7 @@ public class Span extends Area {
* Create the normal flows for this Span
*/
private void createNormalFlows() {
- flowAreas = new java.util.ArrayList(colCount);
+ flowAreas = new java.util.ArrayList<NormalFlow>(colCount);
colWidth = (ipd - ((colCount - 1) * colGap)) / colCount;
for (int i = 0; i < colCount; i++) {
@@ -105,7 +109,7 @@ public class Span extends Area {
*/
public NormalFlow getNormalFlow(int colRequested) {
if (colRequested >= 0 && colRequested < colCount) {
- return (NormalFlow) flowAreas.get(colRequested);
+ return flowAreas.get(colRequested);
} else { // internal error
throw new IllegalArgumentException("Invalid column number "
+ colRequested + " requested; only 0-" + (colCount - 1)
@@ -183,7 +187,30 @@ public class Span extends Area {
return (areaCount == 0);
}
+ /**
+ * Sets the writing mode traits for the main reference area of
+ * this span area.
+ * @param wmtg a WM traits getter
+ */
+ public void setWritingModeTraits(WritingModeTraitsGetter wmtg) {
+ switch ( wmtg.getColumnProgressionDirection().getEnumValue() ) {
+ case Constants.EN_RL:
+ setBidiLevel(1);
+ for ( Iterator<NormalFlow> it = flowAreas.iterator(); it.hasNext();) {
+ it.next().setBidiLevel(1);
+ }
+ break;
+ default:
+ resetBidiLevel();
+ for ( Iterator<NormalFlow> it = flowAreas.iterator(); it.hasNext();) {
+ it.next().resetBidiLevel();
+ }
+ break;
+ }
+ }
+
/** {@inheritDoc} */
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
if (colCount > 1) {
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Trait.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Trait.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Trait.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/Trait.java Thu Apr 5 16:19:19 2012
@@ -24,11 +24,17 @@ import java.io.Serializable;
import org.apache.xmlgraphics.image.loader.ImageInfo;
-import org.apache.fop.fo.Constants;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.traits.BorderProps;
+import org.apache.fop.traits.Direction;
+import org.apache.fop.traits.WritingMode;
import org.apache.fop.util.ColorUtil;
+import static org.apache.fop.fo.Constants.EN_NOREPEAT;
+import static org.apache.fop.fo.Constants.EN_REPEAT;
+import static org.apache.fop.fo.Constants.EN_REPEATX;
+import static org.apache.fop.fo.Constants.EN_REPEATY;
+
// properties should be serialized by the holder
/**
* Area traits used for rendering.
@@ -41,170 +47,130 @@ public final class Trait implements Seri
private Trait() {
}
- /**
- * Id reference line, not resolved.
- * not sure if this is needed.
- */
+ /** Id reference line, not resolved. (not sure if this is needed.) */
//public static final Integer ID_LINK = new Integer(0);
/**
* Internal link trait.
* Contains the PageViewport key and the PROD_ID of the target area
*/
- public static final Integer INTERNAL_LINK = new Integer(1);
+ public static final Integer INTERNAL_LINK = 1;
- /**
- * External link. A URL link to an external resource.
- */
- public static final Integer EXTERNAL_LINK = new Integer(2);
+ /** * External link. A URL link to an external resource. */
+ public static final Integer EXTERNAL_LINK = 2;
- /**
- * The font triplet for the current font.
- */
- public static final Integer FONT = new Integer(3);
+ /** The font triplet for the current font. */
+ public static final Integer FONT = 3;
- /**
- * Font size for the current font.
- */
- public static final Integer FONT_SIZE = new Integer(4);
+ /** Font size for the current font. */
+ public static final Integer FONT_SIZE = 4;
- /**
- * The current color.
- */
- public static final Integer COLOR = new Integer(7);
+ /** The current color. */
+ public static final Integer COLOR = 7;
- /**
- * The ID of the FO that produced an area.
- */
- public static final Integer PROD_ID = new Integer(8);
+ /** The ID of the FO that produced an area. */
+ public static final Integer PROD_ID = 8;
- /**
- * Background trait for an area.
- */
- public static final Integer BACKGROUND = new Integer(9);
+ /** Background trait for an area. */
+ public static final Integer BACKGROUND = 9;
- /**
- * Underline trait used when rendering inline parent.
- */
- public static final Integer UNDERLINE = new Integer(10);
+ /** Underline trait used when rendering inline parent. */
+ public static final Integer UNDERLINE = 10;
- /**
- * Overline trait used when rendering inline parent.
- */
- public static final Integer OVERLINE = new Integer(11);
+ /** Overline trait used when rendering inline parent. */
+ public static final Integer OVERLINE = 11;
- /**
- * Linethrough trait used when rendering inline parent.
- */
- public static final Integer LINETHROUGH = new Integer(12);
+ /** Linethrough trait used when rendering inline parent. */
+ public static final Integer LINETHROUGH = 12;
- /**
- * Shadow offset.
- */
+ /** Shadow offset. */
//public static final Integer OFFSET = new Integer(13);
- /**
- * The shadow for text.
- */
+ /** The shadow for text. */
//public static final Integer SHADOW = new Integer(14);
- /**
- * The border start.
- */
- public static final Integer BORDER_START = new Integer(15);
+ /** The border start. */
+ public static final Integer BORDER_START = 15;
- /**
- * The border end.
- */
- public static final Integer BORDER_END = new Integer(16);
+ /** The border end. */
+ public static final Integer BORDER_END = 16;
- /**
- * The border before.
- */
- public static final Integer BORDER_BEFORE = new Integer(17);
+ /** The border before. */
+ public static final Integer BORDER_BEFORE = 17;
- /**
- * The border after.
- */
- public static final Integer BORDER_AFTER = new Integer(18);
+ /** The border after. */
+ public static final Integer BORDER_AFTER = 18;
- /**
- * The padding start.
- */
- public static final Integer PADDING_START = new Integer(19);
+ /** The padding start. */
+ public static final Integer PADDING_START = 19;
- /**
- * The padding end.
- */
- public static final Integer PADDING_END = new Integer(20);
+ /** The padding end. */
+ public static final Integer PADDING_END = 20;
- /**
- * The padding before.
- */
- public static final Integer PADDING_BEFORE = new Integer(21);
+ /** The padding before. */
+ public static final Integer PADDING_BEFORE = 21;
- /**
- * The padding after.
- */
- public static final Integer PADDING_AFTER = new Integer(22);
+ /** The padding after. */
+ public static final Integer PADDING_AFTER = 22;
- /**
- * The space start.
- */
- public static final Integer SPACE_START = new Integer(23);
+ /** The space start. */
+ public static final Integer SPACE_START = 23;
- /**
- * The space end.
- */
- public static final Integer SPACE_END = new Integer(24);
+ /** The space end. */
+ public static final Integer SPACE_END = 24;
- /**
- * break before
- */
+ /** break before */
//public static final Integer BREAK_BEFORE = new Integer(25);
- /**
- * break after
- */
+ /** break after */
//public static final Integer BREAK_AFTER = new Integer(26);
- /**
- * The start-indent trait.
- */
- public static final Integer START_INDENT = new Integer(27);
+ /** The start-indent trait. */
+ public static final Integer START_INDENT = 27;
- /**
- * The end-indent trait.
- */
- public static final Integer END_INDENT = new Integer(28);
+ /** The end-indent trait. */
+ public static final Integer END_INDENT = 28;
/** The space-before trait. */
- public static final Integer SPACE_BEFORE = new Integer(29);
+ public static final Integer SPACE_BEFORE = 29;
/** The space-after trait. */
- public static final Integer SPACE_AFTER = new Integer(30);
+ public static final Integer SPACE_AFTER = 30;
/** The is-reference-area trait. */
- public static final Integer IS_REFERENCE_AREA = new Integer(31);
+ public static final Integer IS_REFERENCE_AREA = 31;
/** The is-viewport-area trait. */
- public static final Integer IS_VIEWPORT_AREA = new Integer(32);
+ public static final Integer IS_VIEWPORT_AREA = 32;
/** Blinking trait used when rendering inline parent. */
- public static final Integer BLINK = new Integer(33);
+ public static final Integer BLINK = 33;
/** Trait for color of underline decorations when rendering inline parent. */
- public static final Integer UNDERLINE_COLOR = new Integer(34);
+ public static final Integer UNDERLINE_COLOR = 34;
+
/** Trait for color of overline decorations when rendering inline parent. */
- public static final Integer OVERLINE_COLOR = new Integer(35);
+ public static final Integer OVERLINE_COLOR = 35;
+
/** Trait for color of linethrough decorations when rendering inline parent. */
- public static final Integer LINETHROUGH_COLOR = new Integer(36);
+ public static final Integer LINETHROUGH_COLOR = 36;
+
+ /** For navigation in the document structure. */
+ public static final Integer STRUCTURE_TREE_ELEMENT = 37;
- /** The ptr trait. Used for accessibility */
- public static final Integer PTR = new Integer(37);
+ /** writing mode trait */
+ public static final Integer WRITING_MODE = 38;
+ /** inline progression direction trait */
+ public static final Integer INLINE_PROGRESSION_DIRECTION = 39;
+ /** block progression direction trait */
+ public static final Integer BLOCK_PROGRESSION_DIRECTION = 40;
+ /** column progression direction trait */
+ public static final Integer COLUMN_PROGRESSION_DIRECTION = 41;
+ /** shift direction trait */
+ public static final Integer SHIFT_DIRECTION = 42;
/** Maximum value used by trait keys */
- public static final int MAX_TRAIT_KEY = 37;
+ public static final int MAX_TRAIT_KEY = 42;
private static final TraitInfo[] TRAIT_INFO = new TraitInfo[MAX_TRAIT_KEY + 1];
@@ -227,65 +193,55 @@ public final class Trait implements Seri
}
private static void put(Integer key, TraitInfo info) {
- TRAIT_INFO[key.intValue()] = info;
+ TRAIT_INFO[key] = info;
}
static {
// Create a hashmap mapping trait code to name for external representation
//put(ID_LINK, new TraitInfo("id-link", String.class));
- put(PTR, new TraitInfo("ptr", String.class));
- put(INTERNAL_LINK, new TraitInfo("internal-link", InternalLink.class));
- put(EXTERNAL_LINK, new TraitInfo("external-link", ExternalLink.class));
- put(FONT, new TraitInfo("font", FontTriplet.class));
- put(FONT_SIZE, new TraitInfo("font-size", Integer.class));
- put(COLOR, new TraitInfo("color", Color.class));
- put(PROD_ID, new TraitInfo("prod-id", String.class));
- put(BACKGROUND, new TraitInfo("background", Background.class));
- put(UNDERLINE, new TraitInfo("underline-score", Boolean.class));
+ put(STRUCTURE_TREE_ELEMENT, new TraitInfo("structure-tree-element", String.class));
+ put(INTERNAL_LINK, new TraitInfo("internal-link", InternalLink.class));
+ put(EXTERNAL_LINK, new TraitInfo("external-link", ExternalLink.class));
+ put(FONT, new TraitInfo("font", FontTriplet.class));
+ put(FONT_SIZE, new TraitInfo("font-size", Integer.class));
+ put(COLOR, new TraitInfo("color", Color.class));
+ put(PROD_ID, new TraitInfo("prod-id", String.class));
+ put(BACKGROUND, new TraitInfo("background", Background.class));
+ put(UNDERLINE, new TraitInfo("underline-score", Boolean.class));
put(UNDERLINE_COLOR, new TraitInfo("underline-score-color", Color.class));
- put(OVERLINE, new TraitInfo("overline-score", Boolean.class));
+ put(OVERLINE, new TraitInfo("overline-score", Boolean.class));
put(OVERLINE_COLOR, new TraitInfo("overline-score-color", Color.class));
- put(LINETHROUGH, new TraitInfo("through-score", Boolean.class));
+ put(LINETHROUGH, new TraitInfo("through-score", Boolean.class));
put(LINETHROUGH_COLOR, new TraitInfo("through-score-color", Color.class));
- put(BLINK, new TraitInfo("blink", Boolean.class));
- //put(OFFSET, new TraitInfo("offset", Integer.class));
- //put(SHADOW, new TraitInfo("shadow", Integer.class));
- put(BORDER_START,
- new TraitInfo("border-start", BorderProps.class));
- put(BORDER_END,
- new TraitInfo("border-end", BorderProps.class));
- put(BORDER_BEFORE,
- new TraitInfo("border-before", BorderProps.class));
- put(BORDER_AFTER,
- new TraitInfo("border-after", BorderProps.class));
- put(PADDING_START,
- new TraitInfo("padding-start", Integer.class));
- put(PADDING_END,
- new TraitInfo("padding-end", Integer.class));
- put(PADDING_BEFORE,
- new TraitInfo("padding-before", Integer.class));
- put(PADDING_AFTER,
- new TraitInfo("padding-after", Integer.class));
- put(SPACE_START,
- new TraitInfo("space-start", Integer.class));
- put(SPACE_END,
- new TraitInfo("space-end", Integer.class));
- //put(BREAK_BEFORE,
- // new TraitInfo("break-before", Integer.class));
- //put(BREAK_AFTER,
- // new TraitInfo("break-after", Integer.class));
- put(START_INDENT,
- new TraitInfo("start-indent", Integer.class));
- put(END_INDENT,
- new TraitInfo("end-indent", Integer.class));
- put(SPACE_BEFORE,
- new TraitInfo("space-before", Integer.class));
- put(SPACE_AFTER,
- new TraitInfo("space-after", Integer.class));
- put(IS_REFERENCE_AREA,
- new TraitInfo("is-reference-area", Boolean.class));
- put(IS_VIEWPORT_AREA,
- new TraitInfo("is-viewport-area", Boolean.class));
+ put(BLINK, new TraitInfo("blink", Boolean.class));
+ //put(OFFSET, new TraitInfo("offset", Integer.class));
+ //put(SHADOW, new TraitInfo("shadow", Integer.class));
+ put(BORDER_START, new TraitInfo("border-start", BorderProps.class));
+ put(BORDER_END, new TraitInfo("border-end", BorderProps.class));
+ put(BORDER_BEFORE, new TraitInfo("border-before", BorderProps.class));
+ put(BORDER_AFTER, new TraitInfo("border-after", BorderProps.class));
+ put(PADDING_START, new TraitInfo("padding-start", Integer.class));
+ put(PADDING_END, new TraitInfo("padding-end", Integer.class));
+ put(PADDING_BEFORE, new TraitInfo("padding-before", Integer.class));
+ put(PADDING_AFTER, new TraitInfo("padding-after", Integer.class));
+ put(SPACE_START, new TraitInfo("space-start", Integer.class));
+ put(SPACE_END, new TraitInfo("space-end", Integer.class));
+ //put(BREAK_BEFORE, new TraitInfo("break-before", Integer.class));
+ //put(BREAK_AFTER, new TraitInfo("break-after", Integer.class));
+ put(START_INDENT, new TraitInfo("start-indent", Integer.class));
+ put(END_INDENT, new TraitInfo("end-indent", Integer.class));
+ put(SPACE_BEFORE, new TraitInfo("space-before", Integer.class));
+ put(SPACE_AFTER, new TraitInfo("space-after", Integer.class));
+ put(IS_REFERENCE_AREA, new TraitInfo("is-reference-area", Boolean.class));
+ put(IS_VIEWPORT_AREA, new TraitInfo("is-viewport-area", Boolean.class));
+ put(WRITING_MODE,
+ new TraitInfo("writing-mode", WritingMode.class));
+ put(INLINE_PROGRESSION_DIRECTION,
+ new TraitInfo("inline-progression-direction", Direction.class));
+ put(BLOCK_PROGRESSION_DIRECTION,
+ new TraitInfo("block-progression-direction", Direction.class));
+ put(SHIFT_DIRECTION,
+ new TraitInfo("shift-direction", Direction.class));
}
@@ -296,7 +252,7 @@ public final class Trait implements Seri
* @return the trait name
*/
public static String getTraitName(Object traitCode) {
- return TRAIT_INFO[((Integer)traitCode).intValue()].getName();
+ return TRAIT_INFO[(Integer)traitCode].getName();
}
/**
@@ -306,7 +262,7 @@ public final class Trait implements Seri
* @return the class type for the trait
*/
public static Class getTraitClass(Object traitCode) {
- return TRAIT_INFO[((Integer)traitCode).intValue()].getClazz();
+ return TRAIT_INFO[(Integer)traitCode].getClazz();
}
/**
@@ -438,6 +394,7 @@ public final class Trait implements Seri
* Return the human-friendly string for debugging.
* {@inheritDoc}
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("pvKey=").append(pvKey);
@@ -482,7 +439,7 @@ public final class Trait implements Seri
if (v.startsWith("dest=")) {
dest = v.substring(5);
} else if (v.startsWith("newWindow=")) {
- newWindow = Boolean.valueOf(v.substring(10)).booleanValue();
+ newWindow = Boolean.valueOf(v.substring(10));
} else {
throw new IllegalArgumentException(
"Malformed trait value for Trait.ExternalLink: " + traitValue);
@@ -512,6 +469,7 @@ public final class Trait implements Seri
* @return a <code>String</code> of the form
* "org.apache.fop.area.Trait.ExternalLink[dest=someURL,newWindow=false]"
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer(64);
sb.append("newWindow=").append(newWindow);
@@ -652,23 +610,23 @@ public final class Trait implements Seri
private String getRepeatString() {
switch (getRepeat()) {
- case Constants.EN_REPEAT: return "repeat";
- case Constants.EN_REPEATX: return "repeat-x";
- case Constants.EN_REPEATY: return "repeat-y";
- case Constants.EN_NOREPEAT: return "no-repeat";
+ case EN_REPEAT: return "repeat";
+ case EN_REPEATX: return "repeat-x";
+ case EN_REPEATY: return "repeat-y";
+ case EN_NOREPEAT: return "no-repeat";
default: throw new IllegalStateException("Illegal repeat style: " + getRepeat());
}
}
private static int getConstantForRepeat(String repeat) {
if ("repeat".equalsIgnoreCase(repeat)) {
- return Constants.EN_REPEAT;
+ return EN_REPEAT;
} else if ("repeat-x".equalsIgnoreCase(repeat)) {
- return Constants.EN_REPEATX;
+ return EN_REPEATX;
} else if ("repeat-y".equalsIgnoreCase(repeat)) {
- return Constants.EN_REPEATY;
+ return EN_REPEATY;
} else if ("no-repeat".equalsIgnoreCase(repeat)) {
- return Constants.EN_NOREPEAT;
+ return EN_NOREPEAT;
} else {
throw new IllegalStateException("Illegal repeat style: " + repeat);
}
@@ -678,6 +636,7 @@ public final class Trait implements Seri
* Return the string for debugging.
* {@inheritDoc}
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
if (color != null) {
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/AbstractTextArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/AbstractTextArea.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/AbstractTextArea.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/AbstractTextArea.java Thu Apr 5 16:19:19 2012
@@ -185,4 +185,15 @@ public abstract class AbstractTextArea e
public void setBaselineOffset(int baselineOffset) {
this.baselineOffset = baselineOffset;
}
+
+ @Override
+ int getVirtualOffset() {
+ return getBlockProgressionOffset();
+ }
+
+ @Override
+ int getVirtualBPD() {
+ /* Word and space areas don't have a properly set bpd; return this area's bpd instead. */
+ return getBPD();
+ }
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Container.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Container.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Container.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Container.java Thu Apr 5 16:19:19 2012
@@ -19,12 +19,12 @@
package org.apache.fop.area.inline;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
-import java.util.List;
-import java.util.ArrayList;
-
/**
* Container area for inline container.
* This area should be placed in a viewport as a result of the
@@ -38,7 +38,7 @@ public class Container extends Area {
/**
* The list of block areas stacked inside this container
*/
- protected List blocks = new ArrayList();
+ protected List<Block> blocks = new ArrayList<Block>();
/**
* The width of this container
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/FilledArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/FilledArea.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/FilledArea.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/FilledArea.java Thu Apr 5 16:19:19 2012
@@ -19,10 +19,8 @@
package org.apache.fop.area.inline;
-import java.util.List;
-import java.util.ListIterator;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.List;
/**
* Filled area.
@@ -39,9 +37,7 @@ public class FilledArea extends InlinePa
private int unitWidth;
- /**
- * Create a new filled area.
- */
+ /** Create a new filled area. */
public FilledArea() {
}
@@ -52,23 +48,23 @@ public class FilledArea extends InlinePa
* @param v the offset
*/
/*
- public void setOffset(int v) {
+ public void setBlockProgressionOffset(int v) {
setChildOffset(inlines.listIterator(), v);
}
- */
private void setChildOffset(ListIterator childrenIterator, int v) {
while (childrenIterator.hasNext()) {
InlineArea child = (InlineArea) childrenIterator.next();
if (child instanceof InlineParent) {
setChildOffset(((InlineParent) child).getChildAreas().listIterator(), v);
- } else if (child instanceof org.apache.fop.area.inline.Viewport) {
+ } else if (child instanceof InlineViewport) {
// nothing
} else {
- child.setOffset(v);
+ child.setBlockProgressionOffset(v);
}
}
}
+ */
/**
* Set the unit width for the areas to fill the full width.
@@ -88,13 +84,11 @@ public class FilledArea extends InlinePa
return this.unitWidth;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
+ @Override
public int getBPD() {
int bpd = 0;
- for (Iterator childAreaIt = getChildAreas().iterator(); childAreaIt.hasNext();) {
- InlineArea area = (InlineArea)childAreaIt.next();
+ for (InlineArea area : getChildAreas()) {
if (bpd < area.getBPD()) {
bpd = area.getBPD();
}
@@ -110,9 +104,10 @@ public class FilledArea extends InlinePa
*
* @return the list of child areas copied to fill the width
*/
- public List getChildAreas() {
- int units = (int)(getIPD() / unitWidth);
- List newList = new ArrayList();
+ @Override
+ public List<InlineArea> getChildAreas() {
+ int units = getIPD() / unitWidth;
+ List<InlineArea> newList = new ArrayList<InlineArea>();
for (int count = 0; count < units; count++) {
newList.addAll(inlines);
}
@@ -126,10 +121,12 @@ public class FilledArea extends InlinePa
* @param lineShrink the total shrink of the line
* @return true if there is an UnresolvedArea descendant
*/
+ @Override
public boolean applyVariationFactor(double variationFactor,
int lineStretch, int lineShrink) {
setIPD(getIPD() + adjustingInfo.applyVariationFactor(variationFactor));
return false;
}
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/ForeignObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/ForeignObject.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/ForeignObject.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/ForeignObject.java Thu Apr 5 16:19:19 2012
@@ -19,10 +19,10 @@
package org.apache.fop.area.inline;
-import org.apache.fop.area.Area;
-
import org.w3c.dom.Document;
+import org.apache.fop.area.Area;
+
// cacheable object
/**
* Foreign object inline area.
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineArea.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineArea.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineArea.java Thu Apr 5 16:19:19 2012
@@ -20,10 +20,12 @@
package org.apache.fop.area.inline;
import java.io.Serializable;
+import java.util.List;
import org.apache.fop.area.Area;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.Trait;
+import org.apache.fop.complexscripts.bidi.InlineRun;
/**
* Inline Area
@@ -79,7 +81,7 @@ public class InlineArea extends Area {
/**
* offset position from before edge of parent area
*/
- protected int offset = 0;
+ protected int blockProgressionOffset = 0;
/**
* parent area
@@ -101,6 +103,23 @@ public class InlineArea extends Area {
protected InlineAdjustingInfo adjustingInfo = null;
/**
+ * Default constructor for inline area.
+ */
+ public InlineArea() {
+ this ( 0, -1 );
+ }
+
+ /**
+ * Instantiate inline area.
+ * @param blockProgressionOffset a block progression offset or zero
+ * @param bidiLevel a resolved bidi level or -1
+ */
+ protected InlineArea ( int blockProgressionOffset, int bidiLevel ) {
+ this.blockProgressionOffset = blockProgressionOffset;
+ setBidiLevel(bidiLevel);
+ }
+
+ /**
* @return the adjustment information object
*/
public InlineAdjustingInfo getAdjustingInfo() {
@@ -138,25 +157,25 @@ public class InlineArea extends Area {
}
/**
- * Set the offset of this inline area.
+ * Set the block progression offset of this inline area.
* This is used to set the offset of the inline area
* which is relative to the before edge of the parent area.
*
- * @param offset the offset
+ * @param blockProgressionOffset the offset
*/
- public void setOffset(int offset) {
- this.offset = offset;
+ public void setBlockProgressionOffset(int blockProgressionOffset) {
+ this.blockProgressionOffset = blockProgressionOffset;
}
/**
- * Get the offset of this inline area.
+ * Get the block progression offset of this inline area.
* This returns the offset of the inline area
- * which is relative to the before edge of the parent area.
+ * relative to the before edge of the parent area.
*
- * @return the offset
+ * @return the blockProgressionOffset
*/
- public int getOffset() {
- return offset;
+ public int getBlockProgressionOffset() {
+ return blockProgressionOffset;
}
/**
@@ -178,6 +197,7 @@ public class InlineArea extends Area {
*
* {@inheritDoc}
*/
+ @Override
public void addChildArea(Area childArea) {
super.addChildArea(childArea);
if (childArea instanceof InlineArea) {
@@ -185,9 +205,7 @@ public class InlineArea extends Area {
}
}
- /**
- *@return true if the inline area is underlined.
- */
+ /** @return true if the inline area is underlined. */
public boolean hasUnderline() {
return getTraitAsBoolean(Trait.UNDERLINE);
}
@@ -228,6 +246,11 @@ public class InlineArea extends Area {
* @param ipdVariation the variation
*/
public void handleIPDVariation(int ipdVariation) {
+ if (log.isTraceEnabled()) {
+ log.trace("Handling IPD variation for " + getClass().getSimpleName()
+ + ": increase by " + ipdVariation + " mpt.");
+ }
+
increaseIPD(ipdVariation);
notifyIPDVariation(ipdVariation);
}
@@ -247,5 +270,70 @@ public class InlineArea extends Area {
storedIPDVariation += ipdVariation;
}
}
-}
+ /**
+ * Returns the offset that this area would have if its offset and size were taking
+ * children areas into account. The bpd of an inline area is taken from its nominal
+ * font and doesn't depend on the bpds of its children elements. However, in the case
+ * of a basic-link element we want the active area to cover all of the children
+ * elements.
+ *
+ * @return the offset that this area would have if the before-edge of its
+ * content-rectangle were coinciding with the <q>beforest</q> before-edge of its
+ * children allocation-rectangles.
+ * @see #getVirtualBPD()
+ * @see BasicLinkArea
+ */
+ int getVirtualOffset() {
+ return getBlockProgressionOffset();
+ }
+
+ /**
+ * Returns the block-progression-dimension that this area would have if it were taking
+ * its children elements into account. See {@linkplain #getVirtualOffset()}.
+ *
+ * @return the bpd
+ */
+ int getVirtualBPD() {
+ return getBPD();
+ }
+
+ /**
+ * Collection bidi inline runs.
+ * @param runs current list of inline runs
+ * @return modified list of inline runs, having appended new run
+ */
+ public List collectInlineRuns ( List runs ) {
+ assert runs != null;
+ runs.add ( new InlineRun ( this, new int[] {getBidiLevel()}) );
+ return runs;
+ }
+
+ /**
+ * Determine if inline area IA is an ancestor inline area or same as this area.
+ * @param ia inline area to test
+ * @return true if specified inline area is an ancestor or same as this area
+ */
+ public boolean isAncestorOrSelf ( InlineArea ia ) {
+ return ( ia == this ) || isAncestor ( ia );
+ }
+
+ /**
+ * Determine if inline area IA is an ancestor inline area of this area.
+ * @param ia inline area to test
+ * @return true if specified inline area is an ancestor of this area
+ */
+ public boolean isAncestor ( InlineArea ia ) {
+ for ( Area p = getParentArea(); p != null;) {
+ if ( p == ia ) {
+ return true;
+ } else if ( p instanceof InlineArea ) {
+ p = ( (InlineArea) p ).getParentArea();
+ } else {
+ p = null;
+ }
+ }
+ return false;
+ }
+
+}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineBlockParent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineBlockParent.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineBlockParent.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineBlockParent.java Thu Apr 5 16:19:19 2012
@@ -48,6 +48,7 @@ public class InlineBlockParent extends I
*
* @param childArea the child area to add
*/
+ @Override
public void addChildArea(Area childArea) {
if (child != null) {
throw new IllegalStateException("InlineBlockParent may have only one child area.");
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineParent.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineParent.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineParent.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/InlineParent.java Thu Apr 5 16:19:19 2012
@@ -19,10 +19,10 @@
package org.apache.fop.area.inline;
-import org.apache.fop.area.Area;
-
+import java.util.Iterator;
import java.util.List;
-import java.util.ArrayList;
+
+import org.apache.fop.area.Area;
/**
* Inline parent area.
@@ -35,35 +35,48 @@ public class InlineParent extends Inline
/**
* The list of inline areas added to this inline parent.
*/
- protected List inlines = new ArrayList();
+ protected List<InlineArea> inlines = new java.util.ArrayList<InlineArea>();
/** Controls whether the IPD is automatically adjusted based on the area's children. */
protected transient boolean autoSize;
- /**
- * Create a new inline parent to add areas to.
- */
- public InlineParent() {
- }
+ /** The offset of the <q>beforest</q> child area of this area. */
+ protected int minChildOffset;
/**
- * Override generic Area method.
- *
- * @param childArea the child area to add
+ * The offset of the <q>afterest</q> child area of this area. Offset from the
+ * before-edge of this area's content-rectangle and the after-edge of the child area's
+ * allocation-rectangle.
*/
- public void addChildArea(Area childArea) {
+ private int maxAfterEdge;
+
+ @Override
+ public void addChildArea(Area c) {
+ assert c instanceof InlineArea;
if (inlines.size() == 0) {
autoSize = (getIPD() == 0);
}
- if (childArea instanceof InlineArea) {
- InlineArea inlineChildArea = (InlineArea) childArea;
- inlines.add(childArea);
- // set the parent area for the child area
- inlineChildArea.setParentArea(this);
- if (autoSize) {
- increaseIPD(inlineChildArea.getAllocIPD());
- }
+ InlineArea childArea = (InlineArea) c;
+ inlines.add(childArea);
+ // set the parent area for the child area
+ childArea.setParentArea(this);
+ if (autoSize) {
+ increaseIPD(childArea.getAllocIPD());
}
+ updateLevel ( childArea.getBidiLevel() );
+ int childOffset = childArea.getVirtualOffset();
+ minChildOffset = Math.min(minChildOffset, childOffset);
+ maxAfterEdge = Math.max(maxAfterEdge, childOffset + childArea.getVirtualBPD());
+ }
+
+ @Override
+ int getVirtualOffset() {
+ return getBlockProgressionOffset() + minChildOffset;
+ }
+
+ @Override
+ int getVirtualBPD() {
+ return maxAfterEdge - minChildOffset;
}
/**
@@ -71,7 +84,7 @@ public class InlineParent extends Inline
*
* @return the list of child areas
*/
- public List getChildAreas() {
+ public List<InlineArea> getChildAreas() {
return inlines;
}
@@ -82,15 +95,54 @@ public class InlineParent extends Inline
* @param lineShrink the total shrink of the line
* @return true if there is an UnresolvedArea descendant
*/
+ @Override
public boolean applyVariationFactor(double variationFactor,
int lineStretch, int lineShrink) {
- boolean bUnresolvedAreasPresent = false;
+ boolean hasUnresolvedAreas = false;
+ int cumulativeIPD = 0;
// recursively apply variation factor to descendant areas
for (int i = 0, len = inlines.size(); i < len; i++) {
- bUnresolvedAreasPresent |= ((InlineArea)inlines.get(i))
- .applyVariationFactor(variationFactor, lineStretch, lineShrink);
+ InlineArea inline = inlines.get(i);
+ hasUnresolvedAreas |= inline.applyVariationFactor(
+ variationFactor, lineStretch, lineShrink);
+ cumulativeIPD += inline.getIPD(); //Update this area's IPD based on changes to children
+ }
+ setIPD(cumulativeIPD);
+
+ return hasUnresolvedAreas;
+ }
+
+ @Override
+ public List collectInlineRuns ( List runs ) {
+ for ( Iterator<InlineArea> it = getChildAreas().iterator(); it.hasNext();) {
+ InlineArea ia = it.next();
+ runs = ia.collectInlineRuns ( runs );
}
- return bUnresolvedAreasPresent;
+ return runs;
}
-}
+ /**
+ * Reset bidirectionality level of all children to default (-1),
+ * signalling that they will inherit the level of their parent text area.
+ */
+ public void resetChildrenLevel() {
+ for ( Iterator it = inlines.iterator(); it.hasNext();) {
+ ( (InlineArea) it.next() ) .resetBidiLevel();
+ }
+ }
+
+ private void updateLevel ( int newLevel ) {
+ if ( newLevel >= 0 ) {
+ int curLevel = getBidiLevel();
+ if ( curLevel >= 0 ) {
+ if ( newLevel < curLevel ) {
+ setBidiLevel ( newLevel );
+ }
+ } else {
+ setBidiLevel ( newLevel );
+ }
+ }
+ }
+
+
+}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Space.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Space.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Space.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/Space.java Thu Apr 5 16:19:19 2012
@@ -27,4 +27,10 @@ public class Space extends InlineArea {
private static final long serialVersionUID = -8748265505356839796L;
+ /**
+ * Default constructor.
+ */
+ public Space() {
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/SpaceArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/SpaceArea.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/SpaceArea.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/SpaceArea.java Thu Apr 5 16:19:19 2012
@@ -29,7 +29,7 @@ public class SpaceArea extends InlineAre
/**
* The space for this space area
*/
- protected String space;
+ protected char space;
/**
* Is this space adjustable?
@@ -38,25 +38,25 @@ public class SpaceArea extends InlineAre
/**
* Create a space area
- * @param s the space character
- * @param o the offset for the next area
- * @param a is this space adjustable?
+ * @param space the space character
+ * @param blockProgressionOffset the offset for the next area
+ * @param adjustable is this space adjustable?
+ * @param bidiLevel the bidirectional embedding level (or -1 if not defined)
*/
- public SpaceArea(char s, int o, boolean a) {
- space = new String() + s;
- offset = o;
- isAdjustable = a;
+ public SpaceArea(int blockProgressionOffset, int bidiLevel, char space, boolean adjustable) {
+ super ( blockProgressionOffset, bidiLevel );
+ this.space = space;
+ this.isAdjustable = adjustable;
}
- /**
- * @return Returns the space.
- */
+ /** @return Returns the space. */
public String getSpace() {
- return new String(space);
+ return String.valueOf(space);
}
/** @return true if the space is adjustable (WRT word-space processing) */
public boolean isAdjustable() {
return this.isAdjustable;
}
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/TextArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/TextArea.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/TextArea.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/TextArea.java Thu Apr 5 16:19:19 2012
@@ -19,6 +19,10 @@
package org.apache.fop.area.inline;
+import java.util.Arrays;
+
+import org.apache.fop.util.CharUtilities;
+
/**
* A text inline area.
*/
@@ -57,7 +61,7 @@ public class TextArea extends AbstractTe
* @param offset the offset for the next area
*/
public void addWord(String word, int offset) {
- addWord(word, offset, null);
+ addWord(word, 0, null, null, null, offset);
}
/**
@@ -65,25 +69,51 @@ public class TextArea extends AbstractTe
*
* @param word the word string
* @param offset the offset for the next area
- * @param letterAdjust the letter adjustment array (may be null)
+ * @param level bidirectional level that applies to entire word
*/
- public void addWord(String word, int offset, int[] letterAdjust) {
- WordArea wordArea = new WordArea(word, offset, letterAdjust);
+ public void addWord(String word, int offset, int level) {
+ addWord(word, 0, null, makeLevels(level, word.length()), null, offset);
+ }
+
+ /**
+ * Create and add a WordArea child to this TextArea.
+ *
+ * @param word the word string
+ * @param ipd the word's ipd
+ * @param letterAdjust the letter adjustment array (may be null)
+ * @param levels array of resolved bidirectional levels of word characters,
+ * or null if default level
+ * @param gposAdjustments array of general position adjustments or null if none apply
+ * @param blockProgressionOffset the offset for the next area
+ */
+ public void addWord
+ ( String word, int ipd, int[] letterAdjust, int[] levels,
+ int[][] gposAdjustments, int blockProgressionOffset ) {
+ int minWordLevel = findMinLevel ( levels );
+ WordArea wordArea = new WordArea
+ ( blockProgressionOffset, minWordLevel, word, letterAdjust, levels, gposAdjustments );
+ wordArea.setIPD ( ipd );
addChildArea(wordArea);
wordArea.setParentArea(this);
+ updateLevel(minWordLevel);
}
/**
* Create and add a SpaceArea child to this TextArea
*
- * @param space the space character
- * @param offset the offset for the next area
+ * @param space the space character
+ * @param ipd the space's ipd
+ * @param blockProgressionOffset the offset for the next area
* @param adjustable is this space adjustable?
+ * @param level resolved bidirection level of space character
*/
- public void addSpace(char space, int offset, boolean adjustable) {
- SpaceArea spaceArea = new SpaceArea(space, offset, adjustable);
+ public void addSpace
+ ( char space, int ipd, boolean adjustable, int blockProgressionOffset, int level ) {
+ SpaceArea spaceArea = new SpaceArea(blockProgressionOffset, level, space, adjustable);
+ spaceArea.setIPD ( ipd );
addChildArea(spaceArea);
spaceArea.setParentArea(this);
+ updateLevel(level);
}
/**
@@ -99,22 +129,69 @@ public class TextArea extends AbstractTe
*/
public String getText() {
StringBuffer text = new StringBuffer();
- InlineArea child;
// assemble the text
- for (int i = 0; i < inlines.size(); i++) {
- child = (InlineArea) inlines.get(i);
- if (child instanceof WordArea) {
- text.append(((WordArea) child).getWord());
+ for (InlineArea inline : inlines) {
+ if (inline instanceof WordArea) {
+ text.append(((WordArea) inline).getWord());
} else {
- text.append(((SpaceArea) child).getSpace());
+ text.append(((SpaceArea) inline).getSpace());
}
}
return text.toString();
}
/** {@inheritDoc} */
+ @Override
public String toString() {
- return "TextArea{text=" + getText() + "}";
+ StringBuffer sb = new StringBuffer(super.toString());
+ sb.append(" {text=\"");
+ sb.append(CharUtilities.toNCRefs(getText()));
+ sb.append("\"");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ private void updateLevel ( int newLevel ) {
+ if ( newLevel >= 0 ) {
+ int curLevel = getBidiLevel();
+ if ( curLevel >= 0 ) {
+ if ( newLevel < curLevel ) {
+ setBidiLevel ( newLevel );
+ }
+ } else {
+ setBidiLevel ( newLevel );
+ }
+ }
+ }
+
+ private static int findMinLevel ( int[] levels ) {
+ if ( levels != null ) {
+ int lMin = Integer.MAX_VALUE;
+ for ( int i = 0, n = levels.length; i < n; i++ ) {
+ int l = levels [ i ];
+ if ( ( l >= 0 ) && ( l < lMin ) ) {
+ lMin = l;
+ }
+ }
+ if ( lMin == Integer.MAX_VALUE ) {
+ return -1;
+ } else {
+ return lMin;
+ }
+ } else {
+ return -1;
+ }
+ }
+
+ private int[] makeLevels ( int level, int count ) {
+ if ( level >= 0 ) {
+ int[] levels = new int [ count ];
+ Arrays.fill ( levels, level );
+ return levels;
+ } else {
+ return null;
+ }
}
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java Thu Apr 5 16:19:19 2012
@@ -19,12 +19,13 @@
package org.apache.fop.area.inline;
+import java.util.List;
+
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Resolvable;
+import org.apache.fop.complexscripts.bidi.InlineRun;
import org.apache.fop.fonts.Font;
-import java.util.List;
-
/**
* Unresolvable page number area.
* This is a word area that resolves itself to a page number
@@ -83,31 +84,39 @@ public class UnresolvedPageNumber extend
}
/**
+ * Get the (resolved or unresolved) text.
+ *
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
* Resolve the page number idref
* This resolves the idref for this object by getting the page number
* string from the first page in the list of pages that apply
* for this ID. The page number text is then set to the String value
* of the page number.
*
+ * TODO: [GA] May need to run bidi algorithm and script processor
+ * on resolved page number.
+ *
* @param id an id whose PageViewports have been determined
* @param pages the list of PageViewports associated with this ID
*/
- public void resolveIDRef(String id, List pages) {
+ public void resolveIDRef(String id, List<PageViewport> pages) {
if (!resolved && pageIDRef.equals(id) && pages != null) {
if (log.isDebugEnabled()) {
log.debug("Resolving pageNumber: " + id);
}
resolved = true;
- PageViewport page;
- if (pageType == FIRST) {
- page = (PageViewport)pages.get(0);
- } else {
- page = (PageViewport)pages.get(pages.size() - 1);
- }
+ int pageIndex = pageType ? 0 : pages.size() - 1;
+ PageViewport page = pages.get(pageIndex);
// replace the text
removeText();
text = page.getPageNumberString();
- addWord(text, 0);
+ addWord(text, 0, getBidiLevel());
// update ipd
if (font != null) {
handleIPDVariation(font.getWordWidth(text) - getIPD());
@@ -136,8 +145,26 @@ public class UnresolvedPageNumber extend
* @param lineShrink the total shrink of the line
* @return true if there is an UnresolvedArea descendant
*/
+ @Override
public boolean applyVariationFactor(double variationFactor,
int lineStretch, int lineShrink) {
return true;
}
+
+ /**
+ * Collection bidi inline runs.
+ * Override of @{link InlineParent} implementation.
+ *
+ * N.B. [GA] without this override, the page-number-citation_writing_mode_rl
+ * layout engine test will fail. It may be that the test needs to
+ * be updated rather than using this override.
+ * @param runs current list of inline runs
+ * @return modified list of inline runs, having appended new run
+ */
+ @Override
+ public List collectInlineRuns ( List runs ) {
+ assert runs != null;
+ runs.add ( new InlineRun ( this, new int[] {getBidiLevel()}) );
+ return runs;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org