org.foray.graphic.batik
Class PDFTextPainter

java.lang.Object
  extended by org.foray.graphic.batik.PDFTextPainter
All Implemented Interfaces:
org.apache.batik.gvt.TextPainter

public class PDFTextPainter
extends Object
implements org.apache.batik.gvt.TextPainter

Implementation of the Batik TextPainter that handles the drawing of text for SVG.


Constructor Summary
PDFTextPainter(org.axsl.font.FontConsumer consumer, org.apache.commons.logging.Log logger)
          Constructor.
 
Method Summary
 Rectangle2D getBounds2D(org.apache.batik.gvt.TextNode node)
           
 Rectangle2D getGeometryBounds(org.apache.batik.gvt.TextNode node)
           
 Shape getHighlightShape(org.apache.batik.gvt.text.Mark beginMark, org.apache.batik.gvt.text.Mark endMark)
           
 org.apache.batik.gvt.text.Mark getMark(org.apache.batik.gvt.TextNode node, int pos, boolean all)
           
 Shape getOutline(org.apache.batik.gvt.TextNode node)
           
 int[] getSelected(org.apache.batik.gvt.text.Mark start, org.apache.batik.gvt.text.Mark finish)
           
protected  String getText(AttributedCharacterIterator aci)
          Converts the text in an AttributedCharacterIterator into a String.
 void paint(org.apache.batik.gvt.TextNode node, Graphics2D g2d)
           
protected  Point2D paintACI(AttributedCharacterIterator aci, Graphics2D g2d, Point2D loc)
          Paints an AttributedCharacterIterator.
protected  Point2D paintTextRun(org.apache.batik.gvt.renderer.StrokingTextPainter.TextRun run, Graphics2D g2d, Point2D loc)
          Paints a text runs.
protected  void paintTextRuns(List<?> textRuns, Graphics2D g2d, Point2D loc)
          Paints a set of text runs.
 org.apache.batik.gvt.text.Mark selectAt(double x, double y, org.apache.batik.gvt.TextNode node)
           
 org.apache.batik.gvt.text.Mark selectFirst(org.apache.batik.gvt.TextNode node)
           
 org.apache.batik.gvt.text.Mark selectLast(org.apache.batik.gvt.TextNode node)
           
 org.apache.batik.gvt.text.Mark selectTo(double x, double y, org.apache.batik.gvt.text.Mark beginMark)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFTextPainter

public PDFTextPainter(org.axsl.font.FontConsumer consumer,
                      org.apache.commons.logging.Log logger)
Constructor.

Parameters:
consumer - The FontConsumer that should be used for font resolution.
logger - The logger.
Method Detail

paint

public void paint(org.apache.batik.gvt.TextNode node,
                  Graphics2D g2d)
Specified by:
paint in interface org.apache.batik.gvt.TextPainter

paintTextRuns

protected void paintTextRuns(List<?> textRuns,
                             Graphics2D g2d,
                             Point2D loc)
Paints a set of text runs.

Parameters:
textRuns - The text runs to paint.
g2d - The graphics environment.
loc - The location at which the text items should be painted.

paintTextRun

protected Point2D paintTextRun(org.apache.batik.gvt.renderer.StrokingTextPainter.TextRun run,
                               Graphics2D g2d,
                               Point2D loc)
Paints a text runs.

Parameters:
run - The text run to paint.
g2d - The graphics environment.
loc - The location at which the text item should be painted.
Returns:
The ending point.

getText

protected String getText(AttributedCharacterIterator aci)
Converts the text in an AttributedCharacterIterator into a String.

Parameters:
aci - The iterator containing the needed text.
Returns:
The iterator text as a String.

paintACI

protected Point2D paintACI(AttributedCharacterIterator aci,
                           Graphics2D g2d,
                           Point2D loc)
Paints an AttributedCharacterIterator.

Parameters:
aci - The iterator whose content should be painted.
g2d - The graphics environment.
loc - The location at which the text should be painted.
Returns:
The ending point.

getMark

public org.apache.batik.gvt.text.Mark getMark(org.apache.batik.gvt.TextNode node,
                                              int pos,
                                              boolean all)
Specified by:
getMark in interface org.apache.batik.gvt.TextPainter

selectAt

public org.apache.batik.gvt.text.Mark selectAt(double x,
                                               double y,
                                               org.apache.batik.gvt.TextNode node)
Specified by:
selectAt in interface org.apache.batik.gvt.TextPainter

selectTo

public org.apache.batik.gvt.text.Mark selectTo(double x,
                                               double y,
                                               org.apache.batik.gvt.text.Mark beginMark)
Specified by:
selectTo in interface org.apache.batik.gvt.TextPainter

selectFirst

public org.apache.batik.gvt.text.Mark selectFirst(org.apache.batik.gvt.TextNode node)
Specified by:
selectFirst in interface org.apache.batik.gvt.TextPainter

selectLast

public org.apache.batik.gvt.text.Mark selectLast(org.apache.batik.gvt.TextNode node)
Specified by:
selectLast in interface org.apache.batik.gvt.TextPainter

getSelected

public int[] getSelected(org.apache.batik.gvt.text.Mark start,
                         org.apache.batik.gvt.text.Mark finish)
Specified by:
getSelected in interface org.apache.batik.gvt.TextPainter

getHighlightShape

public Shape getHighlightShape(org.apache.batik.gvt.text.Mark beginMark,
                               org.apache.batik.gvt.text.Mark endMark)
Specified by:
getHighlightShape in interface org.apache.batik.gvt.TextPainter

getBounds2D

public Rectangle2D getBounds2D(org.apache.batik.gvt.TextNode node)
Specified by:
getBounds2D in interface org.apache.batik.gvt.TextPainter

getGeometryBounds

public Rectangle2D getGeometryBounds(org.apache.batik.gvt.TextNode node)
Specified by:
getGeometryBounds in interface org.apache.batik.gvt.TextPainter

getOutline

public Shape getOutline(org.apache.batik.gvt.TextNode node)
Specified by:
getOutline in interface org.apache.batik.gvt.TextPainter


Copyright © 2017. All rights reserved.