public abstract class PDFTextUtil
extends java.lang.Object
write(String)
).Modifier and Type | Field and Description |
---|---|
static int |
TR_CLIP
PDF text rendering mode: Add text to path for clipping
|
static int |
TR_FILL
PDF text rendering mode: Fill text
|
static int |
TR_FILL_CLIP
PDF text rendering mode: Fill text and add to path for clipping
|
static int |
TR_FILL_STROKE
PDF text rendering mode: Fill, then stroke text
|
static int |
TR_FILL_STROKE_CLIP
PDF text rendering mode: Fill, then stroke text and add to path for clipping
|
static int |
TR_INVISIBLE
PDF text rendering mode: Neither fill nor stroke text (invisible)
|
static int |
TR_STROKE
PDF text rendering mode: Stroke text
|
static int |
TR_STROKE_CLIP
PDF text rendering mode: Stroke text and add to path for clipping
|
Constructor and Description |
---|
PDFTextUtil()
Main constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
adjustGlyphTJ(double adjust)
Writes a glyph adjust value to the "TJ-Buffer".
|
void |
beginTextObject()
Called when a new text object should be started.
|
void |
concatMatrix(java.awt.geom.AffineTransform at)
Creates a "cm" command.
|
void |
endTextObject()
Called when a text object should be ended.
|
protected void |
initValues()
Resets the state fields.
|
boolean |
isInTextObject()
Indicates whether we are in a text object or not.
|
void |
restoreGraphicsState()
Creates a "Q" command, restoring the entire graphics state to its former value by popping
it from the stack.
|
void |
saveGraphicsState()
Creates a "q" command, pushing a copy of the entire graphics state onto the stack.
|
void |
setTextRenderingMode(boolean fill,
boolean stroke,
boolean addToClip)
Sets the text rendering mode.
|
void |
setTextRenderingMode(int mode)
Sets the text rendering mode.
|
void |
updateTf(java.lang.String fontName,
double fontSize,
boolean multiByte)
Updates the current font.
|
protected abstract void |
write(java.lang.String code)
Writes PDF code.
|
void |
writeTextMatrix(java.awt.geom.AffineTransform localTransform)
Writes a "Tm" command, setting a new text transformation matrix.
|
void |
writeTf(java.lang.String fontName,
double fontSize)
Writes a "Tf" command, setting a new current font.
|
void |
writeTJ()
Writes a "TJ" command, writing out the accumulated buffer with the characters and glyph
positioning values.
|
void |
writeTJMappedChar(char codepoint)
Writes a char to the "TJ-Buffer".
|
public static final int TR_FILL
public static final int TR_STROKE
public static final int TR_FILL_STROKE
public static final int TR_INVISIBLE
public static final int TR_FILL_CLIP
public static final int TR_STROKE_CLIP
public static final int TR_FILL_STROKE_CLIP
public static final int TR_CLIP
protected abstract void write(java.lang.String code)
code
- the PDF code to writepublic boolean isInTextObject()
public void beginTextObject()
public void endTextObject()
protected void initValues()
public void saveGraphicsState()
public void restoreGraphicsState()
public void concatMatrix(java.awt.geom.AffineTransform at)
at
- the transformation matrixpublic void writeTf(java.lang.String fontName, double fontSize)
fontName
- the name of the font to selectfontSize
- the font size (in points)public void updateTf(java.lang.String fontName, double fontSize, boolean multiByte)
fontName
- the name of the font to selectfontSize
- the font size (in points)multiByte
- true indicates the font is a multi-byte font, false means single-bytepublic void setTextRenderingMode(int mode)
mode
- the rendering mode (value 0 to 7, see PDF Spec, constants: TR_*)public void setTextRenderingMode(boolean fill, boolean stroke, boolean addToClip)
fill
- true if the text should be filledstroke
- true if the text should be strokedaddToClip
- true if the path should be added for clippingpublic void writeTextMatrix(java.awt.geom.AffineTransform localTransform)
localTransform
- the new text transformation matrixpublic void writeTJMappedChar(char codepoint)
codepoint
- the mapped character (code point/character code)public void adjustGlyphTJ(double adjust)
adjust
- the glyph adjust value in thousands of text unit space.public void writeTJ()
Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.