org.pz.platypus.plugin.pdf.commands
Class PdfSymbol

java.lang.Object
  extended by org.pz.platypus.plugin.pdf.commands.PdfSymbol
All Implemented Interfaces:
IOutputCommand

public class PdfSymbol
extends java.lang.Object
implements IOutputCommand

This is the command-equivalent that is called by PDF plugin to 'execute' a symbol. It looks what the chars to ouput are to generate the symbol in PDF and it outputs those as text. If Unicode conversion is necessary, that is performed as well.

Author:
alb

Field Summary
private  java.lang.String passedValue
           
private  java.lang.String root
           
 
Constructor Summary
PdfSymbol(java.lang.String symbolRoot, java.lang.String stringToEmit)
           
 
Method Summary
(package private)  java.lang.String extractFontName(java.lang.String fontName, GDD gdd, Token tok)
          Extracts the font name from an extended entry in PdfSymbols.properties, such as: [trademark]={SYMBOL}\\u00E4, where the font name is between braces (so SYMBOL, in this example).
 java.lang.String getCharCode(java.lang.String symEquiv)
          Get the Unicode character code to emit
 char getCharValueForUnicode(java.lang.String unicodeValue)
          Converts a unicode value in the format u9999 to a char representing that number, which can be correctly output as the respective glyph by iText.
 java.lang.String getFontName(java.lang.String symbolEquiv, GDD gdd, Token tok)
           
 java.lang.String getRoot()
          get the root of the command.
 java.lang.String getSymEquivalent()
           
(package private)  java.lang.String getUnicodeValue(java.lang.String symbolAsUnicode)
          Accepts a symbol specified as a unicode symbol (such as \\u12CD).
 int process(IOutputContext context, Token tok, int tokNum)
          method for processing this command in the output plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private java.lang.String root

passedValue

private java.lang.String passedValue
Constructor Detail

PdfSymbol

public PdfSymbol(java.lang.String symbolRoot,
                 java.lang.String stringToEmit)
Method Detail

process

public int process(IOutputContext context,
                   Token tok,
                   int tokNum)
Description copied from interface: IOutputCommand
method for processing this command in the output plugin.

Specified by:
process in interface IOutputCommand
Parameters:
context - the context/state of the output document
tok - the command token as found in the token stream
tokNum - the number of the token in the token list

getCharCode

public java.lang.String getCharCode(java.lang.String symEquiv)
Get the Unicode character code to emit

Parameters:
symEquiv - the symbol equivalent (consisting of what is on the right of the = sign in the symbols resource file. Could contain font + char, or just char to emit.
Returns:
char code, or empty string if an error occurs.

getFontName

public java.lang.String getFontName(java.lang.String symbolEquiv,
                                    GDD gdd,
                                    Token tok)

extractFontName

java.lang.String extractFontName(java.lang.String fontName,
                                 GDD gdd,
                                 Token tok)
Extracts the font name from an extended entry in PdfSymbols.properties, such as: [trademark]={SYMBOL}\\u00E4, where the font name is between braces (so SYMBOL, in this example).

Parameters:
fontName - the string starting with the opening brace
gdd - to look up literals in case of an error
tok - to look up file/line# for use in error message, if any
Returns:
the name of the font or an empty string in case of error.

getUnicodeValue

java.lang.String getUnicodeValue(java.lang.String symbolAsUnicode)
Accepts a symbol specified as a unicode symbol (such as \\u12CD). In Java, this becomes \\\\u12CD. So, this method strips off the leading \ and converts the remaining value into a 1-symbol string.

Parameters:
symbolAsUnicode - the Unicode number as a hex value.
Returns:
the 1-symbol string that symbolAsUnicode resolves to

getCharValueForUnicode

public char getCharValueForUnicode(java.lang.String unicodeValue)
Converts a unicode value in the format u9999 to a char representing that number, which can be correctly output as the respective glyph by iText.

Parameters:
unicodeValue - four-digit hex value that has to be converted to a char
Returns:
char representing the unicode value

getRoot

public java.lang.String getRoot()
Description copied from interface: IOutputCommand
get the root of the command. For example, fsize: in [fsize:12pt]

Specified by:
getRoot in interface IOutputCommand
Returns:
the root as a string

getSymEquivalent

public java.lang.String getSymEquivalent()


Copyright © 2008-10 Pacific Data Works LLC