aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/afp/AFPTextHandler.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-02-26 11:07:20 +0000
committerJeremias Maerki <jeremias@apache.org>2008-02-26 11:07:20 +0000
commit37a7749a651ebac452c68f74ac6801eba9156ec8 (patch)
tree87e19d8061aff7ee0835936298367dfe956f3cfc /src/java/org/apache/fop/render/afp/AFPTextHandler.java
parent5250c87d0ea8ff16a23973244a3c9a410f44272b (diff)
downloadxmlgraphics-fop-37a7749a651ebac452c68f74ac6801eba9156ec8.tar.gz
xmlgraphics-fop-37a7749a651ebac452c68f74ac6801eba9156ec8.zip
Reverted revision 603590 which broke the AFP renderer. The other changes after revision 603590 should be preserved as well as possible, including the switch to the new image library.
Adjustments for change in behaviour of the block viewport CTM. Bugfix: SVG painting is now always done on a color canvas (like for PCL) because Batik cannot handle gradients on a grayscale canvas. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@631178 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/afp/AFPTextHandler.java')
-rw-r--r--src/java/org/apache/fop/render/afp/AFPTextHandler.java106
1 files changed, 0 insertions, 106 deletions
diff --git a/src/java/org/apache/fop/render/afp/AFPTextHandler.java b/src/java/org/apache/fop/render/afp/AFPTextHandler.java
deleted file mode 100644
index a6e8ffeb8..000000000
--- a/src/java/org/apache/fop/render/afp/AFPTextHandler.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.afp;
-
-import java.awt.Color;
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.fop.fonts.Font;
-import org.apache.fop.fonts.FontInfo;
-import org.apache.fop.render.afp.fonts.AFPFont;
-import org.apache.fop.render.afp.modca.GraphicsObject;
-
-import org.apache.xmlgraphics.java2d.TextHandler;
-
-/**
- * Specialized TextHandler implementation that the AFPGraphics2D class delegates to to paint text
- * using AFP GOCA text operations.
- */
-public class AFPTextHandler implements TextHandler {
-
- /** logging instance */
- private static Log log = LogFactory.getLog(AFPTextHandler.class);
-
- private AFPGraphics2D g2d = null;
-
- /** Overriding FontState */
- protected Font overrideFont = null;
-
- /** current state */
- private AFPState afpState = null;
-
- /**
- * Main constructor.
- * @param g2d the PSGraphics2D instance this instances is used by
- */
- public AFPTextHandler(AFPGraphics2D g2d) {
- this.g2d = g2d;
- this.afpState = g2d.getAFPInfo().getState();
- }
-
- /**
- * Return the font information associated with this object
- * @return the FontInfo object
- */
- public FontInfo getFontInfo() {
- return g2d.getAFPInfo().getFontInfo();
- }
-
- /**
- * Add a text string to the current data object of the AFP datastream.
- * The text is painted using text operations.
- * {@inheritDoc}
- */
- public void drawString(String str, float x, float y) throws IOException {
- log.debug("drawString() str=" + str + ", x=" + x + ", y=" + y);
- GraphicsObject graphicsObj = g2d.getGraphicsObject();
- Color col = g2d.getColor();
- if (afpState.setColor(col)) {
- graphicsObj.setColor(col);
- }
- if (overrideFont != null) {
- FontInfo fontInfo = getFontInfo();
- AFPPageFonts pageFonts = this.afpState.getPageFonts();
- String internalFontName = overrideFont.getFontName();
- int fontSize = overrideFont.getFontSize();
- if (afpState.setFontName(internalFontName) || afpState.setFontSize(fontSize)) {
- AFPFont font = (AFPFont)fontInfo.getFonts().get(internalFontName);
- AFPFontAttributes afpFontAttributes = pageFonts.registerFont(
- internalFontName,
- font,
- fontSize
- );
- int fontReference = afpFontAttributes.getFontReference();
- graphicsObj.setCharacterSet(fontReference);
- }
- }
- graphicsObj.addString(str, (int)Math.round(x), (int)Math.round(y));
- }
-
- /**
- * Sets the overriding font.
- * @param overrideFont Overriding Font to set
- */
- public void setOverrideFont(Font overrideFont) {
- this.overrideFont = overrideFont;
- }
-}