Package org.apache.fop.render.ps
Class NativeTextHandler
- java.lang.Object
-
- org.apache.fop.render.ps.NativeTextHandler
-
- All Implemented Interfaces:
org.apache.xmlgraphics.java2d.ps.PSTextHandler
,org.apache.xmlgraphics.java2d.TextHandler
public class NativeTextHandler extends java.lang.Object implements org.apache.xmlgraphics.java2d.ps.PSTextHandler
Specialized TextHandler implementation that the PSGraphics2D class delegates to to paint text using PostScript text operations.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
currentFontName
the current (internal) font nameprotected int
currentFontSize
the current font size in millipointsprotected Font
font
Currently valid Fontprotected FontInfo
fontInfo
FontInfo containing all available fontsprotected Font
overrideFont
Overriding FontStateprivate org.apache.xmlgraphics.java2d.ps.PSGraphics2D
rootG2D
-
Constructor Summary
Constructors Constructor Description NativeTextHandler(org.apache.xmlgraphics.java2d.ps.PSGraphics2D g2d, FontInfo fontInfo)
Main constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Font
createFont(java.awt.Font f)
void
drawString(java.awt.Graphics2D g, java.lang.String s, float x, float y)
Draw a string to the PostScript document.private void
escapeText(java.lang.String text, java.lang.StringBuffer target)
private void
establishCurrentFont()
FontInfo
getFontInfo()
Return the font information associated with this objectprivate org.apache.xmlgraphics.ps.PSGenerator
getPSGenerator()
void
setOverrideFont(Font override)
Sets the overriding font.private void
setupFontInfo()
void
writePageSetup()
void
writeSetup()
-
-
-
Field Detail
-
rootG2D
private org.apache.xmlgraphics.java2d.ps.PSGraphics2D rootG2D
-
fontInfo
protected FontInfo fontInfo
FontInfo containing all available fonts
-
font
protected Font font
Currently valid Font
-
overrideFont
protected Font overrideFont
Overriding FontState
-
currentFontName
protected java.lang.String currentFontName
the current (internal) font name
-
currentFontSize
protected int currentFontSize
the current font size in millipoints
-
-
Constructor Detail
-
NativeTextHandler
public NativeTextHandler(org.apache.xmlgraphics.java2d.ps.PSGraphics2D g2d, FontInfo fontInfo)
Main constructor.- Parameters:
g2d
- the PSGraphics2D instance this instances is used byfontInfo
- the FontInfo object with all available fonts
-
-
Method Detail
-
setupFontInfo
private void setupFontInfo()
-
getFontInfo
public FontInfo getFontInfo()
Return the font information associated with this object- Returns:
- the FontInfo object
-
getPSGenerator
private org.apache.xmlgraphics.ps.PSGenerator getPSGenerator()
-
writeSetup
public void writeSetup() throws java.io.IOException
- Specified by:
writeSetup
in interfaceorg.apache.xmlgraphics.java2d.ps.PSTextHandler
- Throws:
java.io.IOException
-
writePageSetup
public void writePageSetup() throws java.io.IOException
- Specified by:
writePageSetup
in interfaceorg.apache.xmlgraphics.java2d.ps.PSTextHandler
- Throws:
java.io.IOException
-
drawString
public void drawString(java.awt.Graphics2D g, java.lang.String s, float x, float y) throws java.io.IOException
Draw a string to the PostScript document. The text is painted using text operations.- Specified by:
drawString
in interfaceorg.apache.xmlgraphics.java2d.TextHandler
- Throws:
java.io.IOException
-
escapeText
private void escapeText(java.lang.String text, java.lang.StringBuffer target)
-
createFont
private Font createFont(java.awt.Font f)
-
establishCurrentFont
private void establishCurrentFont() throws java.io.IOException
- Throws:
java.io.IOException
-
setOverrideFont
public void setOverrideFont(Font override)
Sets the overriding font.- Parameters:
override
- Overriding Font to set
-
-