git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196344 13f79535-47bb-0310-9956-ffa450edef68pull/30/head
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.apps; | package org.apache.fop.apps; | ||||
// Imported java.io classes | // Imported java.io classes | ||||
/** | /** | ||||
* XSLTInputHandler basically takes an XML file and transforms it with an XSLT | * XSLTInputHandler basically takes an XML file and transforms it with an XSLT | ||||
* file and the resulting XSL-FO document is input for FOP. | * file and the resulting XSL-FO document is input for FOP. | ||||
* @todo add URL constructor | |||||
* (todo) add URL constructor | |||||
*/ | */ | ||||
public class XSLTInputHandler extends InputHandler { | public class XSLTInputHandler extends InputHandler { | ||||
return new InputSource(reader); | return new InputSource(reader); | ||||
} catch (Exception ex) { | } catch (Exception ex) { | ||||
ex.printStackTrace(); | ex.printStackTrace(); | ||||
/**@todo do proper logging of exceptions */ | |||||
/**(todo) do proper logging of exceptions */ | |||||
return null; | return null; | ||||
} | } | ||||
} else { | } else { |
* We have not found a definition of "word" in the standard (1.0), so the | * We have not found a definition of "word" in the standard (1.0), so the | ||||
* logic used here is based on the programmer's best guess. | * logic used here is based on the programmer's best guess. | ||||
* | * | ||||
* @parameter char inputChar: the character to be tested. | |||||
* @param char inputChar: the character to be tested. | |||||
* @return int IS_WORD_CHAR_TRUE, IS_WORD_CHAR_FALSE, or IS_WORD_CHAR_MAYBE, | * @return int IS_WORD_CHAR_TRUE, IS_WORD_CHAR_FALSE, or IS_WORD_CHAR_MAYBE, | ||||
* depending on whether the character should be considered part of a word | * depending on whether the character should be considered part of a word | ||||
* or not. | * or not. |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.fo; | package org.apache.fop.fo; | ||||
// Java | // Java | ||||
* with other resolveable areas | * with other resolveable areas | ||||
*/ | */ | ||||
public class FOUserAgent implements LogEnabled { | public class FOUserAgent implements LogEnabled { | ||||
private Logger log; | private Logger log; | ||||
private Map defaults = new java.util.HashMap(); | private Map defaults = new java.util.HashMap(); | ||||
private Map handlers = new java.util.HashMap(); | private Map handlers = new java.util.HashMap(); | ||||
/** | /** | ||||
* Returns the logger to use. | * Returns the logger to use. | ||||
* @see org.apache.avalon.framework.logger.AbstractLogEnabled#getLogger() | * @see org.apache.avalon.framework.logger.AbstractLogEnabled#getLogger() | ||||
* @todo This breaks IoC/SoC. Should be improved. | |||||
* (todo) This breaks IoC/SoC. Should be improved. | |||||
*/ | */ | ||||
public Logger getLogger() { | public Logger getLogger() { | ||||
return this.log; | return this.log; | ||||
/** | /** | ||||
* Sets the parameters for PDF encryption. | * Sets the parameters for PDF encryption. | ||||
* @param pdfEncryptionParams the PDF encryption parameters, null to | |||||
* @param pdfEncryptionParams the PDF encryption parameters, null to | |||||
* disable PDF encryption | * disable PDF encryption | ||||
*/ | */ | ||||
public void setPDFEncryptionParams(PDFEncryptionParams pdfEncryptionParams) { | public void setPDFEncryptionParams(PDFEncryptionParams pdfEncryptionParams) { | ||||
this.pdfEncryptionParams = pdfEncryptionParams; | this.pdfEncryptionParams = pdfEncryptionParams; | ||||
} | } | ||||
/** | /** | ||||
* Get an input stream for a reference. | * Get an input stream for a reference. | ||||
* Temporary solution until API better. | * Temporary solution until API better. |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.fo.expr; | package org.apache.fop.fo.expr; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
* is set. | * is set. | ||||
* @param dim The dimension of the value. 0 for a Number, 1 for a Length | * @param dim The dimension of the value. 0 for a Number, 1 for a Length | ||||
* (any type), >1, <0 if Lengths have been multiplied or divided. | * (any type), >1, <0 if Lengths have been multiplied or divided. | ||||
* @pcBase The PercentBase object used to calculate an actual value for | |||||
* @param pcBase The PercentBase object used to calculate an actual value for | |||||
* a PC_LENGTH. | * a PC_LENGTH. | ||||
*/ | */ | ||||
protected Numeric(int valType, double absValue, double pcValue, | protected Numeric(int valType, double absValue, double pcValue, |
public boolean isMultiByte() { | public boolean isMultiByte() { | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Returns a PDFWArray containing all the widths of the subset to be used. | * Returns a PDFWArray containing all the widths of the subset to be used. | ||||
* @return the character widths | * @return the character widths | ||||
* @todo Try to avoid dependency on PDF library | |||||
* (todo) Try to avoid dependency on PDF library | |||||
*/ | */ | ||||
public abstract PDFWArray getSubsetWidths(); | public abstract PDFWArray getSubsetWidths(); | ||||
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.fonts; | package org.apache.fop.fonts; | ||||
import java.util.Map; | import java.util.Map; | ||||
/** | /** | ||||
* Abstract base class for custom fonts loaded from files, for example. | * Abstract base class for custom fonts loaded from files, for example. | ||||
*/ | */ | ||||
public abstract class CustomFont extends Font | |||||
public abstract class CustomFont extends Font | |||||
implements FontDescriptor, MutableFont { | implements FontDescriptor, MutableFont { | ||||
private String fontName = null; | private String fontName = null; | ||||
private FontType fontType = FontType.TYPE1; | private FontType fontType = FontType.TYPE1; | ||||
private int firstChar = 0; | private int firstChar = 0; | ||||
private int lastChar = 255; | private int lastChar = 255; | ||||
private Map kerning = new java.util.HashMap(); | private Map kerning = new java.util.HashMap(); | ||||
private boolean useKerning = true; | private boolean useKerning = true; | ||||
} | } | ||||
/** | /** | ||||
* Returns the lookup name to an embeddable font file available as a | |||||
* Returns the lookup name to an embeddable font file available as a | |||||
* resource. | * resource. | ||||
* @todo Remove this method, this should be done using a resource: URI. | |||||
* (todo) Remove this method, this should be done using a resource: URI. | |||||
* @return the lookup name | * @return the lookup name | ||||
*/ | */ | ||||
public String getEmbedResourceName() { | public String getEmbedResourceName() { | ||||
/** | /** | ||||
* Returns the width to be used when no width is available. | * Returns the width to be used when no width is available. | ||||
* @return a character width | |||||
* @return a character width | |||||
*/ | */ | ||||
public int getMissingWidth() { | public int getMissingWidth() { | ||||
return missingWidth; | return missingWidth; | ||||
public FontType getFontType() { | public FontType getFontType() { | ||||
return fontType; | return fontType; | ||||
} | } | ||||
/** | /** | ||||
* Returns the index of the first character defined in this font. | * Returns the index of the first character defined in this font. | ||||
* @return the index of the first character | * @return the index of the first character | ||||
public int getFirstChar() { | public int getFirstChar() { | ||||
return 0; | return 0; | ||||
// return firstChar; | // return firstChar; | ||||
/**@todo Why is this hardcoded??? This code was in SingleByteFont.java */ | |||||
/**(todo) Why is this hardcoded??? This code was in SingleByteFont.java */ | |||||
} | } | ||||
/** | /** | ||||
/* ---- MutableFont interface ---- */ | /* ---- MutableFont interface ---- */ | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setFontName(String) | * @see org.apache.fop.fonts.MutableFont#setFontName(String) | ||||
*/ | */ | ||||
public void setFontName(String name) { | public void setFontName(String name) { | ||||
this.fontName = name; | this.fontName = name; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setEmbedFileName(String) | * @see org.apache.fop.fonts.MutableFont#setEmbedFileName(String) | ||||
*/ | */ | ||||
public void setEmbedFileName(String path) { | public void setEmbedFileName(String path) { | ||||
this.embedFileName = path; | this.embedFileName = path; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setEmbedResourceName(String) | * @see org.apache.fop.fonts.MutableFont#setEmbedResourceName(String) | ||||
*/ | */ | ||||
public void setEmbedResourceName(String name) { | public void setEmbedResourceName(String name) { | ||||
this.embedResourceName = name; | this.embedResourceName = name; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setCapHeight(int) | * @see org.apache.fop.fonts.MutableFont#setCapHeight(int) | ||||
*/ | */ | ||||
public void setCapHeight(int capHeight) { | public void setCapHeight(int capHeight) { | ||||
this.capHeight = capHeight; | this.capHeight = capHeight; | ||||
} | } | ||||
/** | /** | ||||
* Returns the XHeight value of the font. | * Returns the XHeight value of the font. | ||||
* @param xHeight the XHeight value | * @param xHeight the XHeight value | ||||
public void setXHeight(int xHeight) { | public void setXHeight(int xHeight) { | ||||
this.xHeight = xHeight; | this.xHeight = xHeight; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setAscender(int) | * @see org.apache.fop.fonts.MutableFont#setAscender(int) | ||||
*/ | */ | ||||
public void setAscender(int ascender) { | public void setAscender(int ascender) { | ||||
this.ascender = ascender; | this.ascender = ascender; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setDescender(int) | * @see org.apache.fop.fonts.MutableFont#setDescender(int) | ||||
*/ | */ | ||||
public void setDescender(int descender) { | public void setDescender(int descender) { | ||||
this.descender = descender; | this.descender = descender; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setFontBBox(int[]) | * @see org.apache.fop.fonts.MutableFont#setFontBBox(int[]) | ||||
*/ | */ | ||||
public void setFontBBox(int[] bbox) { | public void setFontBBox(int[] bbox) { | ||||
this.fontBBox = bbox; | this.fontBBox = bbox; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setFlags(int) | * @see org.apache.fop.fonts.MutableFont#setFlags(int) | ||||
*/ | */ | ||||
public void setFlags(int flags) { | public void setFlags(int flags) { | ||||
this.flags = flags; | this.flags = flags; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setStemV(int) | * @see org.apache.fop.fonts.MutableFont#setStemV(int) | ||||
*/ | */ | ||||
public void setStemV(int stemV) { | public void setStemV(int stemV) { | ||||
this.stemV = stemV; | this.stemV = stemV; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setItalicAngle(int) | * @see org.apache.fop.fonts.MutableFont#setItalicAngle(int) | ||||
*/ | */ | ||||
public void setItalicAngle(int italicAngle) { | public void setItalicAngle(int italicAngle) { | ||||
this.italicAngle = italicAngle; | this.italicAngle = italicAngle; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setMissingWidth(int) | * @see org.apache.fop.fonts.MutableFont#setMissingWidth(int) | ||||
*/ | */ | ||||
public void setMissingWidth(int width) { | public void setMissingWidth(int width) { | ||||
this.missingWidth = width; | this.missingWidth = width; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setFontType(FontType) | * @see org.apache.fop.fonts.MutableFont#setFontType(FontType) | ||||
*/ | */ | ||||
public void setFirstChar(int index) { | public void setFirstChar(int index) { | ||||
this.firstChar = index; | this.firstChar = index; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setLastChar(int) | * @see org.apache.fop.fonts.MutableFont#setLastChar(int) | ||||
*/ | */ | ||||
public void setLastChar(int index) { | public void setLastChar(int index) { | ||||
this.lastChar = index; | this.lastChar = index; | ||||
} | } | ||||
/** | /** | ||||
* @see org.apache.fop.fonts.MutableFont#setKerningEnabled(boolean) | * @see org.apache.fop.fonts.MutableFont#setKerningEnabled(boolean) | ||||
*/ | */ |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.image; | package org.apache.fop.image; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
* @return the color space | * @return the color space | ||||
*/ | */ | ||||
ColorSpace getColorSpace(); | ColorSpace getColorSpace(); | ||||
/** | /** | ||||
* Returns the ICC profile. | * Returns the ICC profile. | ||||
* @return the ICC profile, null if none is available | * @return the ICC profile, null if none is available | ||||
* @return True if it is transparent | * @return True if it is transparent | ||||
*/ | */ | ||||
boolean isTransparent(); | boolean isTransparent(); | ||||
/** | /** | ||||
* For transparent images. Returns the transparent color. | * For transparent images. Returns the transparent color. | ||||
* @return the transparent color | * @return the transparent color | ||||
* @todo Remove the PDF dependency | |||||
* (todo) Remove the PDF dependency | |||||
*/ | */ | ||||
PDFColor getTransparentColor(); | PDFColor getTransparentColor(); | ||||
/** | /** | ||||
* Indicates whether the image has a Soft Mask (See section 7.5.4 in the | |||||
* Indicates whether the image has a Soft Mask (See section 7.5.4 in the | |||||
* PDF specs) | * PDF specs) | ||||
* @return True if a Soft Mask exists | * @return True if a Soft Mask exists | ||||
*/ | */ | ||||
boolean hasSoftMask(); | boolean hasSoftMask(); | ||||
/** | /** | ||||
* For images with a Soft Mask. Returns the Soft Mask as an array. | * For images with a Soft Mask. Returns the Soft Mask as an array. | ||||
* @return the Soft Mask | * @return the Soft Mask | ||||
byte[] getSoftMask(); | byte[] getSoftMask(); | ||||
/** | /** | ||||
* Returns the decoded and uncompressed image as a array of | |||||
* Returns the decoded and uncompressed image as a array of | |||||
* width * height * [colorspace-multiplicator] pixels. | * width * height * [colorspace-multiplicator] pixels. | ||||
* @return the bitmap | * @return the bitmap | ||||
*/ | */ | ||||
* @return the raw image | * @return the raw image | ||||
*/ | */ | ||||
byte[] getRessourceBytes(); | byte[] getRessourceBytes(); | ||||
/** | /** | ||||
* Returns the number of bytes of the raw image. | * Returns the number of bytes of the raw image. | ||||
* @return the size in bytes | * @return the size in bytes |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.image.analyser; | package org.apache.fop.image.analyser; | ||||
// Java | // Java | ||||
/** | /** | ||||
* Creates an ImageInfo object from an XML image read from a stream. | * Creates an ImageInfo object from an XML image read from a stream. | ||||
* | * | ||||
* @todo This means the external svg document will be loaded twice. Possibly need | |||||
* (todo) This means the external svg document will be loaded twice. Possibly need | |||||
* a slightly different design for the image stuff. | * a slightly different design for the image stuff. | ||||
* | * | ||||
* @param uri The URI to the image | * @param uri The URI to the image |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.layout; | package org.apache.fop.layout; | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
/** | /** | ||||
* This class defines area classes. | * This class defines area classes. | ||||
* @todo Would better be replaced by an Enum (Avalon or Commons) | |||||
* (todo) Would better be replaced by an Enum (Avalon or Commons) | |||||
*/ | */ | ||||
public class AreaClass { | public class AreaClass { | ||||
public static final String UNASSIGNED = "unassigned"; | public static final String UNASSIGNED = "unassigned"; | ||||
// checker method | // checker method | ||||
public static String setAreaClass(String areaClass) throws FOPException { | public static String setAreaClass(String areaClass) throws FOPException { | ||||
if (areaClass.equals(XSL_NORMAL) | |||||
if (areaClass.equals(XSL_NORMAL) | |||||
|| areaClass.equals(XSL_ABSOLUTE) | || areaClass.equals(XSL_ABSOLUTE) | ||||
|| areaClass.equals(XSL_FOOTNOTE) | || areaClass.equals(XSL_FOOTNOTE) | ||||
|| areaClass.equals(XSL_SIDE_FLOAT) | || areaClass.equals(XSL_SIDE_FLOAT) |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.layout.hyphenation; | package org.apache.fop.layout.hyphenation; | ||||
/** | /** | ||||
* @author Carlos Villegas <cav@uniscope.co.jp> | * @author Carlos Villegas <cav@uniscope.co.jp> | ||||
* @todo Derive from FOPException | |||||
* (todo) Derive from FOPException | |||||
*/ | */ | ||||
public class HyphenationException extends Exception { | public class HyphenationException extends Exception { | ||||
protected char[] eq; | protected char[] eq; | ||||
/** | /** | ||||
* <P>The character stored in this node: splitchar | |||||
* <P>The character stored in this node: splitchar. | |||||
* Two special values are reserved:</P> | * Two special values are reserved:</P> | ||||
* <ul><li>0x0000 as string terminator</li> | * <ul><li>0x0000 as string terminator</li> | ||||
* <li>0xFFFF to indicate that the branch starting at | * <li>0xFFFF to indicate that the branch starting at |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.layoutmgr; | package org.apache.fop.layoutmgr; | ||||
import org.apache.fop.fo.flow.Marker; | import org.apache.fop.fo.flow.Marker; | ||||
* area passed in. | * area passed in. | ||||
* | * | ||||
* @param childArea the child area to get the parent for | * @param childArea the child area to get the parent for | ||||
* @return the parent Area | |||||
* @return the parent Area | |||||
*/ | */ | ||||
Area getParentArea(Area childArea); | Area getParentArea(Area childArea); | ||||
/** | /** | ||||
* Add an id to the page. | * Add an id to the page. | ||||
* @todo add the location of the area on the page | |||||
* (todo) add the location of the area on the page | |||||
* | * | ||||
* @param id the id reference to add. | * @param id the id reference to add. | ||||
*/ | */ |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.pdf; | package org.apache.fop.pdf; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
* add an ICC profile to the document). | * add an ICC profile to the document). | ||||
* | * | ||||
* @param doc the PDF parent document | * @param doc the PDF parent document | ||||
* @todo Remove this and deletgate to the XObject | |||||
* (todo) Remove this and delegate to the XObject | |||||
*/ | */ | ||||
void setup(PDFDocument doc); | void setup(PDFDocument doc); | ||||
} | } | ||||
/** | /** | ||||
* @param ext <todo> Description of the Parameter | |||||
* @param ext (todo) Description of the Parameter | |||||
* @see org.apache.fop.render.Renderer | * @see org.apache.fop.render.Renderer | ||||
*/ | */ | ||||
public void renderExtension(TreeExt ext) { } | public void renderExtension(TreeExt ext) { } | ||||
} | } | ||||
/** | /** | ||||
* <todo> Description of the Method | |||||
* (todo) Description of the Method | |||||
* | * | ||||
* @param ctm The coordinate transformation matrix to use | * @param ctm The coordinate transformation matrix to use | ||||
*/ | */ | ||||
} | } | ||||
/** | /** | ||||
* <todo> Description of the Method | |||||
* (todo) Description of the Method | |||||
*/ | */ | ||||
protected void endVParea() { } | protected void endVParea() { } | ||||
* | * | ||||
* @param image The image | * @param image The image | ||||
* @param pos The target position of the image | * @param pos The target position of the image | ||||
* <todo> Make renderImage() protected | |||||
* (todo) Make renderImage() protected | |||||
*/ | */ | ||||
public void renderImage(Image image, Rectangle2D pos) { | public void renderImage(Image image, Rectangle2D pos) { | ||||
// Default: do nothing. | // Default: do nothing. | ||||
* | * | ||||
* @param fo The foreign object area | * @param fo The foreign object area | ||||
* @param pos The target position of the foreign object | * @param pos The target position of the foreign object | ||||
* <todo> Make renderForeignObject() protected | |||||
* (todo) Make renderForeignObject() protected | |||||
*/ | */ | ||||
public void renderForeignObject(ForeignObject fo, Rectangle2D pos) { | public void renderForeignObject(ForeignObject fo, Rectangle2D pos) { | ||||
// Default: do nothing. | // Default: do nothing. |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.render.ps; | package org.apache.fop.render.ps; | ||||
//Java | //Java | ||||
* @see org.apache.fop.svg.PSGraphics2D | * @see org.apache.fop.svg.PSGraphics2D | ||||
*/ | */ | ||||
public class PSDocumentGraphics2D extends PSGraphics2D { | public class PSDocumentGraphics2D extends PSGraphics2D { | ||||
private int width; | private int width; | ||||
private int height; | private int height; | ||||
//Setup for PostScript generation | //Setup for PostScript generation | ||||
setPSGenerator(new PSGenerator(stream)); | setPSGenerator(new PSGenerator(stream)); | ||||
//PostScript Header | //PostScript Header | ||||
gen.writeln(DSCConstants.PS_ADOBE_30); | gen.writeln(DSCConstants.PS_ADOBE_30); | ||||
gen.writeDSCComment(DSCConstants.CREATOR, | |||||
gen.writeDSCComment(DSCConstants.CREATOR, | |||||
new String[] {"FOP PostScript Transcoder for SVG"}); | new String[] {"FOP PostScript Transcoder for SVG"}); | ||||
gen.writeDSCComment(DSCConstants.CREATION_DATE, | |||||
gen.writeDSCComment(DSCConstants.CREATION_DATE, | |||||
new Object[] {new java.util.Date()}); | new Object[] {new java.util.Date()}); | ||||
gen.writeDSCComment(DSCConstants.PAGES, new Object[] {new Integer(1)}); | gen.writeDSCComment(DSCConstants.PAGES, new Object[] {new Integer(1)}); | ||||
gen.writeDSCComment(DSCConstants.BBOX, new Object[] | gen.writeDSCComment(DSCConstants.BBOX, new Object[] | ||||
{zero, zero, pagewidth, pageheight}); | {zero, zero, pagewidth, pageheight}); | ||||
gen.writeDSCComment(DSCConstants.END_COMMENTS); | gen.writeDSCComment(DSCConstants.END_COMMENTS); | ||||
//Defaults | //Defaults | ||||
gen.writeDSCComment(DSCConstants.BEGIN_DEFAULTS); | gen.writeDSCComment(DSCConstants.BEGIN_DEFAULTS); | ||||
gen.writeDSCComment(DSCConstants.END_DEFAULTS); | gen.writeDSCComment(DSCConstants.END_DEFAULTS); | ||||
//Prolog | //Prolog | ||||
gen.writeDSCComment(DSCConstants.BEGIN_PROLOG); | gen.writeDSCComment(DSCConstants.BEGIN_PROLOG); | ||||
gen.writeDSCComment(DSCConstants.END_PROLOG); | gen.writeDSCComment(DSCConstants.END_PROLOG); | ||||
//Setup | //Setup | ||||
gen.writeDSCComment(DSCConstants.BEGIN_SETUP); | gen.writeDSCComment(DSCConstants.BEGIN_SETUP); | ||||
PSProcSets.writeFOPStdProcSet(gen); | PSProcSets.writeFOPStdProcSet(gen); | ||||
//Start page | //Start page | ||||
Integer pageNumber = new Integer(1); | Integer pageNumber = new Integer(1); | ||||
gen.writeDSCComment(DSCConstants.PAGE, new Object[] | |||||
gen.writeDSCComment(DSCConstants.PAGE, new Object[] | |||||
{pageNumber.toString(), pageNumber}); | {pageNumber.toString(), pageNumber}); | ||||
gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] | gen.writeDSCComment(DSCConstants.PAGE_BBOX, new Object[] | ||||
{zero, zero, pagewidth, pageheight}); | {zero, zero, pagewidth, pageheight}); | ||||
gen.writeDSCComment(DSCConstants.BEGIN_PAGE_SETUP); | |||||
gen.writeDSCComment(DSCConstants.BEGIN_PAGE_SETUP); | |||||
gen.writeln("FOPFonts begin"); | gen.writeln("FOPFonts begin"); | ||||
gen.writeln("0.001 0.001 scale"); | gen.writeln("0.001 0.001 scale"); | ||||
gen.concatMatrix(1, 0, 0, -1, 0, pageheight.doubleValue() * 1000); | gen.concatMatrix(1, 0, 0, -1, 0, pageheight.doubleValue() * 1000); | ||||
gen.writeDSCComment(DSCConstants.END_PAGE_SETUP); | |||||
gen.writeDSCComment(DSCConstants.END_PAGE_SETUP); | |||||
} | } | ||||
* @param col the background colour to fill | * @param col the background colour to fill | ||||
*/ | */ | ||||
public void setBackgroundColor(Color col) { | public void setBackgroundColor(Color col) { | ||||
/**@todo Implement this */ | |||||
/**(todo) Implement this */ | |||||
/* | /* | ||||
Color c = col; | Color c = col; | ||||
PDFColor currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue()); | PDFColor currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue()); | ||||
*/ | */ | ||||
public void finish() throws IOException { | public void finish() throws IOException { | ||||
//Finish page | //Finish page | ||||
gen.writeln("showpage"); | |||||
gen.writeln("showpage"); | |||||
gen.writeDSCComment(DSCConstants.PAGE_TRAILER); | gen.writeDSCComment(DSCConstants.PAGE_TRAILER); | ||||
gen.writeDSCComment(DSCConstants.END_PAGE); | gen.writeDSCComment(DSCConstants.END_PAGE); | ||||
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.render.ps; | package org.apache.fop.render.ps; | ||||
import java.awt.Graphics2D; | import java.awt.Graphics2D; | ||||
* drawString. If the text is complex or the cannot be translated | * drawString. If the text is complex or the cannot be translated | ||||
* into a simple drawString the StrokingTextPainter is used instead. | * into a simple drawString the StrokingTextPainter is used instead. | ||||
* | * | ||||
* @todo handle underline, overline and strikethrough | |||||
* @todo use drawString(AttributedCharacterIterator iterator...) for some | |||||
* (todo) handle underline, overline and strikethrough | |||||
* (todo) use drawString(AttributedCharacterIterator iterator...) for some | |||||
* | * | ||||
* @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a> | * @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a> | ||||
* @version $Id: PSTextPainter.java,v 1.15 2003/01/08 14:03:55 jeremias Exp $ | * @version $Id: PSTextPainter.java,v 1.15 2003/01/08 14:03:55 jeremias Exp $ |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.servlet; | package org.apache.fop.servlet; | ||||
import java.io.File; | import java.io.File; | ||||
* Example URL: http://servername/fop/servlet/FopPrintServlet?fo=readme.fo | * Example URL: http://servername/fop/servlet/FopPrintServlet?fo=readme.fo | ||||
* <br/> | * <br/> | ||||
* Example URL: http://servername/fop/servlet/FopPrintServlet?xml=data.xml&xsl=format.xsl | * Example URL: http://servername/fop/servlet/FopPrintServlet?xml=data.xml&xsl=format.xsl | ||||
* | |||||
* | |||||
* @author <a href="mailto:fop-dev@xml.apache.org">Apache XML FOP Development Team</a> | * @author <a href="mailto:fop-dev@xml.apache.org">Apache XML FOP Development Team</a> | ||||
* @version $Id: FopPrintServlet.java,v 1.2 2003/03/07 09:48:05 jeremias Exp $ | * @version $Id: FopPrintServlet.java,v 1.2 2003/03/07 09:48:05 jeremias Exp $ | ||||
* @todo Doesn't work since there's no AWTRenderer at the moment. Revisit when | |||||
* (todo) Doesn't work since there's no AWTRenderer at the moment. Revisit when | |||||
* available. | * available. | ||||
* @todo Don't use XSLTInputHandler anymore | |||||
* @todo Ev. add caching mechanism for Templates objects | |||||
* (todo) Don't use XSLTInputHandler anymore | |||||
* (todo) Ev. add caching mechanism for Templates objects | |||||
*/ | */ | ||||
public class FopPrintServlet extends HttpServlet { | public class FopPrintServlet extends HttpServlet { | ||||
protected static final String XML_REQUEST_PARAM = "xml"; | protected static final String XML_REQUEST_PARAM = "xml"; | ||||
/** Name of the parameter used for the XSLT file */ | /** Name of the parameter used for the XSLT file */ | ||||
protected static final String XSLT_REQUEST_PARAM = "xslt"; | protected static final String XSLT_REQUEST_PARAM = "xslt"; | ||||
/** Logger to give to FOP */ | /** Logger to give to FOP */ | ||||
protected Logger log = null; | protected Logger log = null; | ||||
/** The TransformerFactory to use to create Transformer instances */ | /** The TransformerFactory to use to create Transformer instances */ | ||||
// private helper, tell (browser) user that file printed | // private helper, tell (browser) user that file printed | ||||
private void reportOK(HttpServletResponse response) | private void reportOK(HttpServletResponse response) | ||||
throws ServletException { | throws ServletException { | ||||
String sMsg = "<html><title>Success</title>\n" | |||||
+ "<body><h1>FopPrintServlet: </h1>" | |||||
String sMsg = "<html><title>Success</title>\n" | |||||
+ "<body><h1>FopPrintServlet: </h1>" | |||||
+ "<h3>The requested data was printed</h3></body></html>"; | + "<h3>The requested data was printed</h3></body></html>"; | ||||
response.setContentType("text/html"); | response.setContentType("text/html"); | ||||
//removePage( | //removePage( | ||||
// Integer.parseInt((String) numbers.elementAt(i))); | // Integer.parseInt((String) numbers.elementAt(i))); | ||||
} | } | ||||
try { | try { | ||||
printerJob.print(); | printerJob.print(); | ||||
} catch (PrinterException e) { | } catch (PrinterException e) { | ||||
e.printStackTrace(); | e.printStackTrace(); | ||||
throw new IOException("Unable to print: " | |||||
throw new IOException("Unable to print: " | |||||
+ e.getClass().getName() + ": " + e.getMessage()); | + e.getClass().getName() + ": " + e.getMessage()); | ||||
} | } | ||||
} | } |
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.servlet; | package org.apache.fop.servlet; | ||||
import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
* <br/> | * <br/> | ||||
* Example URL: http://servername/fop/servlet/FopServlet?xml=data.xml&xslt=format.xsl | * Example URL: http://servername/fop/servlet/FopServlet?xml=data.xml&xslt=format.xsl | ||||
* <br/> | * <br/> | ||||
* For this to work with Internet Explorer, you might need to append "&ext=.pdf" | |||||
* For this to work with Internet Explorer, you might need to append "&ext=.pdf" | |||||
* to the URL. | * to the URL. | ||||
* | |||||
* | |||||
* @author <a href="mailto:fop-dev@xml.apache.org">Apache XML FOP Development Team</a> | * @author <a href="mailto:fop-dev@xml.apache.org">Apache XML FOP Development Team</a> | ||||
* @version $Id: FopServlet.java,v 1.2 2003/03/07 09:48:05 jeremias Exp $ | * @version $Id: FopServlet.java,v 1.2 2003/03/07 09:48:05 jeremias Exp $ | ||||
* @todo Ev. add caching mechanism for Templates objects | |||||
* (todo) Ev. add caching mechanism for Templates objects | |||||
*/ | */ | ||||
public class FopServlet extends HttpServlet { | public class FopServlet extends HttpServlet { | ||||
/** Name of the parameter used for the XSL-FO file */ | /** Name of the parameter used for the XSL-FO file */ | ||||
protected static final String FO_REQUEST_PARAM = "fo"; | protected static final String FO_REQUEST_PARAM = "fo"; | ||||
/** Name of the parameter used for the XML file */ | /** Name of the parameter used for the XML file */ | ||||
protected static final String XML_REQUEST_PARAM = "xml"; | protected static final String XML_REQUEST_PARAM = "xml"; | ||||
/** Name of the parameter used for the XSLT file */ | /** Name of the parameter used for the XSLT file */ | ||||
protected static final String XSLT_REQUEST_PARAM = "xslt"; | protected static final String XSLT_REQUEST_PARAM = "xslt"; | ||||
/** Logger to give to FOP */ | /** Logger to give to FOP */ | ||||
protected Logger log = null; | protected Logger log = null; | ||||
/** The TransformerFactory to use to create Transformer instances */ | /** The TransformerFactory to use to create Transformer instances */ | ||||
String foParam = request.getParameter(FO_REQUEST_PARAM); | String foParam = request.getParameter(FO_REQUEST_PARAM); | ||||
String xmlParam = request.getParameter(XML_REQUEST_PARAM); | String xmlParam = request.getParameter(XML_REQUEST_PARAM); | ||||
String xsltParam = request.getParameter(XSLT_REQUEST_PARAM); | String xsltParam = request.getParameter(XSLT_REQUEST_PARAM); | ||||
//Analyze parameters and decide with method to use | //Analyze parameters and decide with method to use | ||||
byte[] content = null; | byte[] content = null; | ||||
if (foParam != null) { | if (foParam != null) { | ||||
} | } | ||||
/** | /** | ||||
* Renders an XSL-FO file into a PDF file. The PDF is written to a byte | |||||
* Renders an XSL-FO file into a PDF file. The PDF is written to a byte | |||||
* array that is returned as the method's result. | * array that is returned as the method's result. | ||||
* @param fo the XSL-FO file | * @param fo the XSL-FO file | ||||
* @return byte[] the rendered PDF file | * @return byte[] the rendered PDF file | ||||
* @throws FOPException If an error occurs during the rendering of the | |||||
* @throws FOPException If an error occurs during the rendering of the | |||||
* XSL-FO | * XSL-FO | ||||
* @throws TransformerException If an error occurs while parsing the input | * @throws TransformerException If an error occurs while parsing the input | ||||
* file | * file | ||||
*/ | */ | ||||
protected byte[] renderFO(String fo) | protected byte[] renderFO(String fo) | ||||
throws FOPException, TransformerException { | throws FOPException, TransformerException { | ||||
//Setup source | //Setup source | ||||
Source foSrc = convertString2Source(fo); | Source foSrc = convertString2Source(fo); | ||||
//Setup the identity transformation | //Setup the identity transformation | ||||
Transformer transformer = this.transFactory.newTransformer(); | Transformer transformer = this.transFactory.newTransformer(); | ||||
//Start transformation and rendering process | //Start transformation and rendering process | ||||
return render(foSrc, transformer); | return render(foSrc, transformer); | ||||
} | } | ||||
* @param xml the XML file | * @param xml the XML file | ||||
* @param xslt the XSLT file | * @param xslt the XSLT file | ||||
* @return byte[] the rendered PDF file | * @return byte[] the rendered PDF file | ||||
* @throws FOPException If an error occurs during the rendering of the | |||||
* @throws FOPException If an error occurs during the rendering of the | |||||
* XSL-FO | * XSL-FO | ||||
* @throws TransformerException If an error occurs during XSL | * @throws TransformerException If an error occurs during XSL | ||||
* transformation | * transformation | ||||
*/ | */ | ||||
protected byte[] renderXML(String xml, String xslt) | |||||
protected byte[] renderXML(String xml, String xslt) | |||||
throws FOPException, TransformerException { | throws FOPException, TransformerException { | ||||
//Setup sources | //Setup sources | ||||
/** | /** | ||||
* Renders an input file (XML or XSL-FO) into a PDF file. It uses the JAXP | * Renders an input file (XML or XSL-FO) into a PDF file. It uses the JAXP | ||||
* transformer given to optionally transform the input document to XSL-FO. | * transformer given to optionally transform the input document to XSL-FO. | ||||
* The transformer may be an identity transformer in which case the input | |||||
* The transformer may be an identity transformer in which case the input | |||||
* must already be XSL-FO. The PDF is written to a byte array that is | * must already be XSL-FO. The PDF is written to a byte array that is | ||||
* returned as the method's result. | * returned as the method's result. | ||||
* @param src Input XML or XSL-FO | * @param src Input XML or XSL-FO | ||||
* @param transformer Transformer to use for optional transformation | * @param transformer Transformer to use for optional transformation | ||||
* @return byte[] the rendered PDF file | * @return byte[] the rendered PDF file | ||||
* @throws FOPException If an error occurs during the rendering of the | |||||
* @throws FOPException If an error occurs during the rendering of the | |||||
* XSL-FO | * XSL-FO | ||||
* @throws TransformerException If an error occurs during XSL | * @throws TransformerException If an error occurs during XSL | ||||
* transformation | * transformation | ||||
*/ | */ | ||||
protected byte[] render(Source src, Transformer transformer) | |||||
protected byte[] render(Source src, Transformer transformer) | |||||
throws FOPException, TransformerException { | throws FOPException, TransformerException { | ||||
//Setup FOP | //Setup FOP | ||||
//Setup output | //Setup output | ||||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | ByteArrayOutputStream out = new ByteArrayOutputStream(); | ||||
driver.setOutputStream(out); | driver.setOutputStream(out); | ||||
//Make sure the XSL transformation's result is piped through to FOP | //Make sure the XSL transformation's result is piped through to FOP | ||||
Result res = new SAXResult(driver.getContentHandler()); | Result res = new SAXResult(driver.getContentHandler()); | ||||
//Start the transformation and rendering process | //Start the transformation and rendering process | ||||
transformer.transform(src, res); | transformer.transform(src, res); | ||||
* ============================================================================ | * ============================================================================ | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | ||||
* | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without modifica- | * Redistribution and use in source and binary forms, with or without modifica- | ||||
* tion, are permitted provided that the following conditions are met: | * tion, are permitted provided that the following conditions are met: | ||||
* | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | ||||
* and/or other materials provided with the distribution. | * and/or other materials provided with the distribution. | ||||
* | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if any, must | * 3. The end-user documentation included with the redistribution, if any, must | ||||
* include the following acknowledgment: "This product includes software | * include the following acknowledgment: "This product includes software | ||||
* developed by the Apache Software Foundation (http://www.apache.org/)." | * developed by the Apache Software Foundation (http://www.apache.org/)." | ||||
* Alternately, this acknowledgment may appear in the software itself, if | * Alternately, this acknowledgment may appear in the software itself, if | ||||
* and wherever such third-party acknowledgments normally appear. | * and wherever such third-party acknowledgments normally appear. | ||||
* | |||||
* | |||||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | * 4. The names "FOP" and "Apache Software Foundation" must not be used to | ||||
* endorse or promote products derived from this software without prior | * endorse or promote products derived from this software without prior | ||||
* written permission. For written permission, please contact | * written permission. For written permission, please contact | ||||
* apache@apache.org. | * apache@apache.org. | ||||
* | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache", nor may | * 5. Products derived from this software may not be called "Apache", nor may | ||||
* "Apache" appear in their name, without prior written permission of the | * "Apache" appear in their name, without prior written permission of the | ||||
* Apache Software Foundation. | * Apache Software Foundation. | ||||
* | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | ||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
* ============================================================================ | * ============================================================================ | ||||
* | |||||
* | |||||
* This software consists of voluntary contributions made by many individuals | * This software consists of voluntary contributions made by many individuals | ||||
* on behalf of the Apache Software Foundation and was originally created by | * on behalf of the Apache Software Foundation and was originally created by | ||||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | * James Tauber <jtauber@jtauber.com>. For more information on the Apache | ||||
* Software Foundation, please see <http://www.apache.org/>. | * Software Foundation, please see <http://www.apache.org/>. | ||||
*/ | |||||
*/ | |||||
package org.apache.fop.svg; | package org.apache.fop.svg; | ||||
import java.awt.Graphics2D; | import java.awt.Graphics2D; | ||||
* drawString. If the text is complex or the cannot be translated | * drawString. If the text is complex or the cannot be translated | ||||
* into a simple drawString the StrokingTextPainter is used instead. | * into a simple drawString the StrokingTextPainter is used instead. | ||||
* | * | ||||
* @todo handle underline, overline and strikethrough | |||||
* @todo use drawString(AttributedCharacterIterator iterator...) for some | |||||
* (todo) handle underline, overline and strikethrough | |||||
* (todo) use drawString(AttributedCharacterIterator iterator...) for some | |||||
* | * | ||||
* @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a> | * @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a> | ||||
* @version $Id: PDFTextPainter.java,v 1.16 2003/03/07 09:51:25 jeremias Exp $ | * @version $Id: PDFTextPainter.java,v 1.16 2003/03/07 09:51:25 jeremias Exp $ |