//log.debug( "Current Font=" + currentFont );
//log.debug( "currentFontSize=" + currentFontSize );
}
else if( operation.equals( "Tj" ) )
{
COSString string = (COSString)arguments.get( 0 );
TextPosition pos = showString( string.getBytes() );
if (log.isDebugEnabled())
{
log.debug("<Tj string=\"" + string.getString() + "\">");
}
}
else if( operation.equals( "TJ" ) )
{
Matrix td = new Matrix();
COSArray array = (COSArray)arguments.get( 0 );
for( int i=0; i<array.size(); i++ )
{
COSBase next = array.get( i );
if( next instanceof COSNumber )
{
float value = -1*
(((COSNumber)next).floatValue()/1000) *
currentFontSize.floatValue() *
textMatrix.getValue(1,1);
if (log.isDebugEnabled())
{
log.debug( "<TJ(" + i + ") value=\"" + value +
"\", param=\"" + ((COSNumber)next).floatValue() +
"\", fontsize=\"" + currentFontSize.floatValue() + "\">" );
}
td.setValue( 2, 0, value );
textMatrix = textMatrix.multiply( td );
}
else if( next instanceof COSString )
{
TextPosition pos = showString( ((COSString)next).getBytes() );
if (log.isDebugEnabled())
{
log.debug("<TJ(" + i + ") string=\"" + pos.getString() + "\">");
}
}
else
{
throw new IOException( "Unknown type in array for TJ operation:" + next );
}
}
}
else if( operation.equals( "TL" ) )
{
COSNumber leading = (COSNumber)arguments.get( 0 );
currentLeading = leading.floatValue();
if (log.isDebugEnabled())
{
log.debug("<TL leading=\"" + leading.floatValue() + "\" >");
}
}
else if( operation.equals( "Tm" ) )
{
//Set text matrix and text line matrix
COSNumber a = (COSNumber)arguments.get( 0 );
COSNumber b = (COSNumber)arguments.get( 1 );
COSNumber c = (COSNumber)arguments.get( 2 );
COSNumber d = (COSNumber)arguments.get( 3 );
COSNumber e = (COSNumber)arguments.get( 4 );
COSNumber f = (COSNumber)arguments.get( 5 );
if (log.isDebugEnabled())
{
log.debug("<Tm " +
"a=\"" + a.floatValue() + "\" " +
"b=\"" + b.floatValue() + "\" " +
"c=\"" + c.floatValue() + "\" " +
"d=\"" + d.floatValue() + "\" " +
"e=\"" + e.floatValue() + "\" " +
"f=\"" + f.floatValue() + "\" >");
}
textMatrix = new Matrix();
textMatrix.setValue( 0, 0, a.floatValue() );
textMatrix.setValue( 0, 1, b.floatValue() );
textMatrix.setValue( 1, 0, c.floatValue() );
textMatrix.setValue( 1, 1, d.floatValue() );
textMatrix.setValue( 2, 0, e.floatValue() );
textMatrix.setValue( 2, 1, f.floatValue() );
textLineMatrix = textMatrix.copy();
}/**
else if( operation.equals( "Tr" ) )
{
//Set text rendering mode
//System.out.println( "<Tr>" );
}
else if( operation.equals( "Ts" ) )
{
//Set text rise
//System.out.println( "<Ts>" );
}**/
else if( operation.equals( "Tw" ) )
{
//set word spacing
COSNumber wordSpacing = (COSNumber)arguments.get( 0 );
if (log.isDebugEnabled())
{
log.debug("<Tw wordSpacing=\"" + wordSpacing.floatValue() + "\" />");
}
currentWordSpacing = wordSpacing.floatValue();
}/**
else if( operation.equals( "Tz" ) )
{
//Set horizontal text scaling
}
else if( operation.equals( "v" ) )
{
//Append curved segment to path (initial point replicated)
}
else if( operation.equals( "w" ) )
{
//Set the line width in the graphics state
//System.out.println( "<w>" );
}
else if( operation.equals( "W" ) )
{
//Set clipping path using nonzero winding number rule
//System.out.println( "<W>" );
}
else if( operation.equals( "W*" ) )
{
//Set clipping path using even-odd rule
}
else if( operation.equals( "y" ) )
{
//Append curved segment to path (final point replicated)
}*/
else if( operation.equals( "'" ) )
{
// Move to start of next text line, and show text
//
COSString string = (COSString)arguments.get( 0 );
if (log.isDebugEnabled())
{
log.debug("<' string=\"" + string.getString() + "\">");
}
Matrix td = new Matrix();
td.setValue( 2, 1, -1 * currentLeading * textMatrix.getValue(1,1));
textLineMatrix = textLineMatrix.multiply( td );
textMatrix = textLineMatrix.copy();
showString( string.getBytes() );
}
else if( operation.equals( "\"" ) )
{
//Set word and character spacing, move to next line, and show text
//
COSNumber wordSpacing = (COSNumber)arguments.get( 0 );
COSNumber characterSpacing = (COSNumber)arguments.get( 1 );
COSString string = (COSString)arguments.get( 2 );
if (log.isDebugEnabled())
{
log.debug("<\" wordSpacing=\"" + wordSpacing +
"\", characterSpacing=\"" + characterSpacing +
"\", string=\"" + string.getString() + "\">");
}
currentCharacterSpacing = characterSpacing.floatValue();
currentWordSpacing = wordSpacing.floatValue();
Matrix td = new Matrix();
td.setValue( 2, 1, -1 * currentLeading * textMatrix.getValue(1,1));
textLineMatrix = textLineMatrix.multiply( td );
textMatrix = textLineMatrix.copy();
showString( string.getBytes() );
}
}