Package org.apache.fop.afp.ptoca
Class PtocaBuilder
- java.lang.Object
-
- org.apache.fop.afp.ptoca.PtocaBuilder
-
- All Implemented Interfaces:
PtocaConstants
- Direct Known Subclasses:
PresentationTextObject.DefaultBuilder
public abstract class PtocaBuilder extends java.lang.Object implements PtocaConstants
Generator class for PTOCA data structures.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.commons.io.output.ByteArrayOutputStreambaoutprivate java.awt.ColorcurrentColorthe current colorprivate intcurrentFontthe current fontprivate intcurrentInterCharacterAdjustmentthe current inter character adjustmentprivate intcurrentOrientationthe current orientationprivate intcurrentVariableSpaceCharacterIncrementthe current variable space incrementprivate intcurrentXthe current x coordinate.private intcurrentYthe current y coordinate
-
Constructor Summary
Constructors Constructor Description PtocaBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidabsoluteMoveBaseline(int coordinate)Establishes the baseline and the current presentation position at a new B-axis coordinate, which is a specified number of measurement units from the I-axis.voidabsoluteMoveInline(int coordinate)Establishes the current presentation position on the baseline at a new I-axis coordinate, which is a specified number of measurement units from the B-axis.voidaddTransparentData(CharactersetEncoder.EncodedChars encodedChars)The Transparent Data control sequence contains a sequence of code points that are presented without a scan for embedded control sequences.private static bytechained(byte functionType)private voidcommit(byte functionType)voiddrawBaxisRule(int length, int width)Draws a line of specified length and specified width in the B-direction from the current presentation position.voiddrawIaxisRule(int length, int width)Draws a line of specified length and specified width in the I-direction from the current presentation position.voidendChainedControlSequence()A control sequence is a sequence of bytes that specifies a control function.protected abstract java.io.OutputStreamgetOutputStreamForControlSequence(int length)Returns anOutputStreamfor the next control sequence.private voidnewControlSequence()voidrelativeMoveInline(int increment)Moves the inline coordinate of the presentation position relative to the current inline position.voidsetCodedFont(byte font)The Set Coded Font Local control sequence activates a coded font and specifies the character attributes to be used.voidsetExtendedTextColor(java.awt.Color col)The Set Extended Text Color control sequence specifies a color value and defines the color space and encoding for that value.voidsetInterCharacterAdjustment(int incr)Sets the intercharacter adjustment (additional increment or decrement between graphic characters).voidsetTextOrientation(int orientation)The Set Text Orientation control sequence establishes the I-direction and B-direction for the subsequent text.voidsetVariableSpaceCharacterIncrement(int incr)Sets the variable space character increment.private voidwriteBytes(int... data)voidwriteIntroducer()Writes the introducer for a chained control sequence.private voidwriteShort(int data)
-
-
-
Field Detail
-
baout
private org.apache.commons.io.output.ByteArrayOutputStream baout
-
currentX
private int currentX
the current x coordinate.
-
currentY
private int currentY
the current y coordinate
-
currentFont
private int currentFont
the current font
-
currentOrientation
private int currentOrientation
the current orientation
-
currentColor
private java.awt.Color currentColor
the current color
-
currentVariableSpaceCharacterIncrement
private int currentVariableSpaceCharacterIncrement
the current variable space increment
-
currentInterCharacterAdjustment
private int currentInterCharacterAdjustment
the current inter character adjustment
-
-
Method Detail
-
getOutputStreamForControlSequence
protected abstract java.io.OutputStream getOutputStreamForControlSequence(int length)
Returns anOutputStreamfor the next control sequence. This gives a subclass a chance to do chunking of control sequences into multiple presentation text data objects.- Parameters:
length- the length of the following control sequence- Returns:
- the output stream where the control sequence will be written to
-
chained
private static byte chained(byte functionType)
-
newControlSequence
private void newControlSequence()
-
commit
private void commit(byte functionType) throws java.io.IOException- Throws:
java.io.IOException
-
writeBytes
private void writeBytes(int... data)
-
writeShort
private void writeShort(int data)
-
writeIntroducer
public void writeIntroducer() throws java.io.IOExceptionWrites the introducer for a chained control sequence.- Throws:
java.io.IOException- if an I/O error occurs
-
setCodedFont
public void setCodedFont(byte font) throws java.io.IOExceptionThe Set Coded Font Local control sequence activates a coded font and specifies the character attributes to be used.This is a modal control sequence.
- Parameters:
font- The font local identifier.- Throws:
java.io.IOException- if an I/O error occurs
-
absoluteMoveInline
public void absoluteMoveInline(int coordinate) throws java.io.IOExceptionEstablishes the current presentation position on the baseline at a new I-axis coordinate, which is a specified number of measurement units from the B-axis. There is no change to the current B-axis coordinate.- Parameters:
coordinate- The coordinate for the inline move.- Throws:
java.io.IOException- if an I/O error occurs
-
relativeMoveInline
public void relativeMoveInline(int increment) throws java.io.IOExceptionMoves the inline coordinate of the presentation position relative to the current inline position.- Parameters:
increment- the increment in 1/1440 inch units- Throws:
java.io.IOException- if an I/O error occurs
-
absoluteMoveBaseline
public void absoluteMoveBaseline(int coordinate) throws java.io.IOExceptionEstablishes the baseline and the current presentation position at a new B-axis coordinate, which is a specified number of measurement units from the I-axis. There is no change to the current I-axis coordinate.- Parameters:
coordinate- The coordinate for the baseline move.- Throws:
java.io.IOException- if an I/O error occurs
-
addTransparentData
public void addTransparentData(CharactersetEncoder.EncodedChars encodedChars) throws java.io.IOException
The Transparent Data control sequence contains a sequence of code points that are presented without a scan for embedded control sequences. If the data is larger than fits in one chunk, additional chunks are automatically generated.- Parameters:
encodedChars- The encoded text data to add.- Throws:
java.io.IOException- if an I/O error occurs
-
drawBaxisRule
public void drawBaxisRule(int length, int width) throws java.io.IOExceptionDraws a line of specified length and specified width in the B-direction from the current presentation position. The location of the current presentation position is unchanged.- Parameters:
length- The length of the rule.width- The width of the rule.- Throws:
java.io.IOException- if an I/O error occurs
-
drawIaxisRule
public void drawIaxisRule(int length, int width) throws java.io.IOExceptionDraws a line of specified length and specified width in the I-direction from the current presentation position. The location of the current presentation position is unchanged.- Parameters:
length- The length of the rule.width- The width of the rule.- Throws:
java.io.IOException- if an I/O error occurs
-
setTextOrientation
public void setTextOrientation(int orientation) throws java.io.IOExceptionThe Set Text Orientation control sequence establishes the I-direction and B-direction for the subsequent text. This is a modal control sequence. Semantics: This control sequence specifies the I-axis and B-axis orientations with respect to the Xp-axis for the current Presentation Text object. The orientations are rotational values expressed in degrees and minutes.- Parameters:
orientation- The text orientation (0, 90, 180, 270).- Throws:
java.io.IOException- if an I/O error occurs
-
setExtendedTextColor
public void setExtendedTextColor(java.awt.Color col) throws java.io.IOExceptionThe Set Extended Text Color control sequence specifies a color value and defines the color space and encoding for that value. The specified color value is applied to foreground areas of the text presentation space.This is a modal control sequence.
- Parameters:
col- The color to be set.- Throws:
java.io.IOException- if an I/O error occurs
-
setVariableSpaceCharacterIncrement
public void setVariableSpaceCharacterIncrement(int incr) throws java.io.IOExceptionSets the variable space character increment.This is a modal control sequence.
- Parameters:
incr- The increment to be set (positive integer, 1/1440 inch)- Throws:
java.io.IOException- if an I/O error occurs
-
setInterCharacterAdjustment
public void setInterCharacterAdjustment(int incr) throws java.io.IOExceptionSets the intercharacter adjustment (additional increment or decrement between graphic characters).This is a modal control sequence.
- Parameters:
incr- The increment to be set (1/1440 inch)- Throws:
java.io.IOException- if an I/O error occurs
-
endChainedControlSequence
public void endChainedControlSequence() throws java.io.IOExceptionA control sequence is a sequence of bytes that specifies a control function. A control sequence consists of a control sequence introducer and zero or more parameters. The control sequence can extend multiple presentation text data objects, but must eventually be terminated. This method terminates the control sequence (by using a NOP command).- Throws:
java.io.IOException- if an I/O error occurs
-
-