--- /dev/null
+org.apache.fop.render.afp.extensions.AFPElementMapping
\ No newline at end of file
}
convertToGrayScaleImage(io, fopimage.getBitmaps());
}
- }
- else
- {
+ } else {
if (!fopimage.load(FopImage.BITMAP)) {
return;
}
// Create an AFPFontAttributes object from the current font details
AFPFontAttributes afpFontAttributes =
- new AFPFontAttributes(name, tf,_currentFontSize);
+ new AFPFontAttributes(name, tf, _currentFontSize);
if (!_currentPageFonts.containsKey(afpFontAttributes.getFontKey())) {
// Font not found on current page, so add the new one
|| rotation == 270) {
_portraitRotation = rotation;
} else {
- throw new IllegalArgumentException("The portrait rotation must be one of the values 0, 90, 180, 270");
+ throw new IllegalArgumentException("The portrait rotation must be one"
+ + " of the values 0, 90, 180, 270");
}
|| rotation == 270) {
_landscapeRotation = rotation;
} else {
- throw new IllegalArgumentException("The landscape rotation must be one of the values 0, 90, 180, 270");
-
+ throw new IllegalArgumentException("The landscape rotation must be one"
+ + " of the values 0, 90, 180, 270");
}
}
}
ViewPortPos(Rectangle2D view, CTM ctm) {
- ViewPortPos currentVP = (ViewPortPos)viewPortPositions.get(viewPortPositions.size()-1);
+ ViewPortPos currentVP = (ViewPortPos)viewPortPositions.get(viewPortPositions.size() - 1);
int xOrigin;
int yOrigin;
int width;
int height;
switch (currentVP.rot) {
case 90:
- width = mpts2units(view.getHeight());;
+ width = mpts2units(view.getHeight());
height = mpts2units(view.getWidth());
xOrigin = _pageWidth - width - mpts2units(view.getY()) - currentVP.y;
yOrigin = mpts2units(view.getX()) + currentVP.x;
break;
case 180:
width = mpts2units(view.getWidth());
- height = mpts2units(view.getHeight());;
+ height = mpts2units(view.getHeight());
xOrigin = _pageWidth - width - mpts2units(view.getX()) - currentVP.x;
yOrigin = _pageHeight - height - mpts2units(view.getY()) - currentVP.y;
break;
*/
/* $Id$ */
+
package org.apache.fop.render.afp.exceptions;
import java.io.PrintStream;
*
*/
public abstract class NestedRuntimeException extends RuntimeException {
-
- /** Root cause of this nested exception */
- private Throwable _underlyingException;
-
- /**
- * Construct a <code>NestedRuntimeException</code> with the specified detail message.
- * @param msg The detail message.
- */
- public NestedRuntimeException(String msg) {
- super(msg);
- }
-
- /**
- * Construct a <code>NestedRuntimeException</code> with the specified
- * detail message and nested exception.
- * @param msg The detail message.
- * @param t The nested exception.
- */
- public NestedRuntimeException(String msg, Throwable t) {
- super(msg);
- _underlyingException = t;
-
- }
-
- /**
- * Gets the original triggering exception
- * @return The original exception as a throwable.
- */
- public Throwable getUnderlyingException() {
-
- return _underlyingException;
-
- }
-
- /**
- * Return the detail message, including the message from the nested
- * exception if there is one.
- * @return The detail message.
- */
- public String getMessage() {
-
- if (_underlyingException == null) {
- return super.getMessage();
- } else {
- return super.getMessage()
- + "; nested exception is "
- + _underlyingException.getClass().getName();
- }
-
- }
-
- /**
- * Print the composite message and the embedded stack trace to the specified stream.
- * @param ps the print stream
- */
- public void printStackTrace(PrintStream ps) {
- if (_underlyingException == null) {
- super.printStackTrace(ps);
- } else {
- ps.println(this);
- _underlyingException.printStackTrace(ps);
- }
- }
-
- /**
- * Print the composite message and the embedded stack trace to the specified writer.
- * @param pw the print writer
- */
- public void printStackTrace(PrintWriter pw) {
- if (_underlyingException == null) {
- super.printStackTrace(pw);
- } else {
- pw.println(this);
- _underlyingException.printStackTrace(pw);
- }
- }
-
+
+ /** Root cause of this nested exception */
+ private Throwable _underlyingException;
+
+ /**
+ * Construct a <code>NestedRuntimeException</code> with the specified detail message.
+ * @param msg The detail message.
+ */
+ public NestedRuntimeException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Construct a <code>NestedRuntimeException</code> with the specified
+ * detail message and nested exception.
+ * @param msg The detail message.
+ * @param t The nested exception.
+ */
+ public NestedRuntimeException(String msg, Throwable t) {
+ super(msg);
+ _underlyingException = t;
+
+ }
+
+ /**
+ * Gets the original triggering exception
+ * @return The original exception as a throwable.
+ */
+ public Throwable getUnderlyingException() {
+
+ return _underlyingException;
+
+ }
+
+ /**
+ * Return the detail message, including the message from the nested
+ * exception if there is one.
+ * @return The detail message.
+ */
+ public String getMessage() {
+
+ if (_underlyingException == null) {
+ return super.getMessage();
+ } else {
+ return super.getMessage()
+ + "; nested exception is "
+ + _underlyingException.getClass().getName();
+ }
+
+ }
+
+ /**
+ * Print the composite message and the embedded stack trace to the specified stream.
+ * @param ps the print stream
+ */
+ public void printStackTrace(PrintStream ps) {
+ if (_underlyingException == null) {
+ super.printStackTrace(ps);
+ } else {
+ ps.println(this);
+ _underlyingException.printStackTrace(ps);
+ }
+ }
+
+ /**
+ * Print the composite message and the embedded stack trace to the specified writer.
+ * @param pw the print writer
+ */
+ public void printStackTrace(PrintWriter pw) {
+ if (_underlyingException == null) {
+ super.printStackTrace(pw);
+ } else {
+ pw.println(this);
+ _underlyingException.printStackTrace(pw);
+ }
+ }
+
}
* <p/>
*/
public class RendererRuntimeException extends NestedRuntimeException {
-
- /**
- * Constructs a RendererRuntimeException with the specified message.
- * @param msg the exception mesaage
- */
- public RendererRuntimeException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs a RendererRuntimeException with the specified message
- * wrapping the underlying exception.
- * @param msg the exception mesaage
- * @param t the underlying exception
- */
- public RendererRuntimeException(String msg, Throwable t) {
- super(msg, t);
- }
-
+
+ /**
+ * Constructs a RendererRuntimeException with the specified message.
+ * @param msg the exception mesaage
+ */
+ public RendererRuntimeException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructs a RendererRuntimeException with the specified message
+ * wrapping the underlying exception.
+ * @param msg the exception mesaage
+ * @param t the underlying exception
+ */
+ public RendererRuntimeException(String msg, Throwable t) {
+ super(msg, t);
+ }
+
}
/**
* Overide the make method to return the property object
+ * @param propertyList the property list from which to make the property
* @return property The property object.
*/
public Property make(PropertyList propertyList) {
/**
* The namespace used for AFP extensions
*/
- public static final String NAMESPACE = "http://org.apache.fop/extensions/afp";
+ public static final String NAMESPACE = "http://xmlgraphics.apache.org/fop/extensions/afp";
/**
* The usual namespace prefix used for AFP extensions
/**
* Sets the value
- * @param value The value name to set.
+ * @param source The value name to set.
*/
public void setValue(String source) {
this.value = source;
/**
* Returns the character set for a given size
* @param size the font size
+ * @return the character set object
*/
public abstract CharacterSet getCharacterSet(int size);
/**
* XHeight refers to the height of the lower case letters above
* the baseline.
- * @return heightX the typical height of characters
+ * @return heightX the typical height of characters
*/
public int getXHeight() {
return _xHeight;
* Descender depth is the distance from the character baseline to
* the bottom of a character box. A negative descender depth signifies
* that all of the graphic character is above the character baseline.
- * @param descender the descender value in millipoints
+ * @param descender the descender value in millipoints
*/
public void setDescender(int descender) {
_descender = descender;
* Set the width (in 1/1000ths of a point size) of the character
* identified by the parameter passed.
* @param character the character for which the width is being set
- * @param width the widths of the character
+ * @param width the widths of the character
*/
public void setWidth(int character, int width) {
*/
/* $Id$ */
+
package org.apache.fop.render.afp.fonts;
import org.apache.fop.fonts.Typeface;
* @param encoding the encoding of the font
* @param name the character set name
* @param size the font size
- * @param Typeface the fop character set
+ * @param characterSet the fop character set
*/
public FopCharacterSet(
String codePage,
*/
/* $Id$ */
-package org.apache.fop.render.afp.fonts;
+package org.apache.fop.render.afp.fonts;
/**
* A font defined as a set of lines and curves as opposed to a bitmap font. An
public int[] getWidths(int size) {
int[] widths = _characterSet.getWidths();
- for (int i = 0 ; i < widths.length; i++) {
+ for (int i = 0; i < widths.length; i++) {
widths[i] = widths[i] / 1000 * size;
}
return widths;
/**
* Constructor for the image object with the specified name,
* the name must be a fixed length of eight characters.
- * @param name The name of the image.
+ * @param name The name of the image.
*/
public IMImageObject(String name) {
/**
* Constructor for the image object with the specified name,
* the name must be a fixed length of eight characters.
- * @param name The name of the image.
+ * @param name The name of the image.
*/
public ImageObject(String name) {
break;
}
- for(int i = 0; i < repeat; i++) {
+ for (int i = 0; i < repeat; i++) {
System.arraycopy(greypattern, 0, rasterdata, i * 32, 32);
/**
* Constructor for the image segment with the specified name,
* the name must be a fixed length of eight characters.
- * @param name The name of the image.
+ * @param name The name of the image.
*/
public ImageSegment(String name) {
/**
* Adds an overlay to the page resources
- * @param the overlay to add
+ * @param overlay the overlay to add
*/
public void addOverlay(Overlay overlay) {
if (_resourceGroup == null) {
ByteArrayOutputStream afpdata) {
afpdata.write(new byte[] {
- 15 // Control sequence length
- , (byte)0x81 // Control sequence function type
- , 0x00 // Reserved; must be zero
- , 0x01 // Color space - 0x01 = RGB
- , 0x00 // Reserved; must be zero
- , 0x00 // Reserved; must be zero
- , 0x00 // Reserved; must be zero
- , 0x00 // Reserved; must be zero
- , 8 // Number of bits in component 1
- , 8 // Number of bits in component 2
- , 8 // Number of bits in component 3
- , 0 // Number of bits in component 4
+ 15 // Control sequence length
+ , (byte)0x81 // Control sequence function type
+ , 0x00 // Reserved; must be zero
+ , 0x01 // Color space - 0x01 = RGB
+ , 0x00 // Reserved; must be zero
+ , 0x00 // Reserved; must be zero
+ , 0x00 // Reserved; must be zero
+ , 0x00 // Reserved; must be zero
+ , 8 // Number of bits in component 1
+ , 8 // Number of bits in component 2
+ , 8 // Number of bits in component 3
+ , 0 // Number of bits in component 4
, (byte)(col.getRed()) // Red intensity
, (byte)(col.getGreen()) // Green intensity
, (byte)(col.getBlue()) // Blue intensity
*/
/* $Id$ */
+
package org.apache.fop.render.afp.tools;
import java.io.IOException;
throws IOException {
URL resource = null;
- if( AFP_DTD_1_2_ID.equals(publicId) ) {
+ if ( AFP_DTD_1_2_ID.equals(publicId) ) {
resource = getResource( AFP_DTD_1_2_RESOURCE );
- } else if( AFP_DTD_1_1_ID.equals(publicId) ) {
+ } else if ( AFP_DTD_1_1_ID.equals(publicId) ) {
resource = getResource( AFP_DTD_1_1_RESOURCE );
- } else if( AFP_DTD_1_0_ID.equals(publicId) ) {
+ } else if ( AFP_DTD_1_0_ID.equals(publicId) ) {
throw new FontRuntimeException(
"The AFP Installed Font Definition 1.0 DTD is not longer supported" );
} else if( systemId != null && systemId.indexOf("afp-fonts.dtd") >= 0 ) {
* @return the URL of the required resource
* @throws FontRuntimeException if the resource could not be found.
*/
- private URL getResource( String resourcePath ) {
+ private URL getResource(String resourcePath) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
URL resource = cl.getResource( resourcePath );
- if( resource == null ) {
+ if (resource == null) {
throw new FontRuntimeException( "Resource " + resourcePath +
" could not be found on the classpath" );
}
* Get the next structured field as identified by the identifer
* parameter (this must be a valid MO:DCA structured field.
* @param identifier the three byte identifier
+ * @throws IOException
*/
public byte[] getNext(byte[] identifier) throws IOException {
length[0] = bufferData[b];
length[1] = bufferData[a];
- int reclength = ((length[0] & 0xFF) << 8) + (length[1] & 0xFF) - identifier.length -2;
+ int reclength = ((length[0] & 0xFF) << 8)
+ + (length[1] & 0xFF) - identifier.length - 2;
byte[] retval = new byte[reclength];