intarsys PDF library API

de.intarsys.pdf.font
Class DifferenceEncoding

java.lang.Object
  extended by de.intarsys.pdf.encoding.Encoding
      extended by de.intarsys.pdf.font.DifferenceEncoding

public class DifferenceEncoding
extends Encoding

An encoding defined as a delta to another base encoding.

   the encoding difference is defined in the form
   ...
   num name name name
   num name..
   ...
 

where num is the codepoint for the first glyph name in the list. The following names are mapped to the codepoint of the predecessor + 1. Multiple redefinition offsets can be defined.


Field Summary
static COSName DK_BaseEncoding
           
static COSName DK_Differences
           
 
Fields inherited from class de.intarsys.pdf.encoding.Encoding
CN_MacRomanEncoding, CN_StandardEncoding, CN_WinAnsiEncoding, NAME_a, NAME_A, NAME_aacute, NAME_Aacute, NAME_acircumflex, NAME_Acircumflex, NAME_acute, NAME_adieresis, NAME_Adieresis, NAME_ae, NAME_AE, NAME_agrave, NAME_Agrave, NAME_ampersand, NAME_aring, NAME_Aring, NAME_asciicircum, NAME_asciitilde, NAME_asterisk, NAME_at, NAME_atilde, NAME_Atilde, NAME_b, NAME_B, NAME_backslash, NAME_bar, NAME_braceleft, NAME_braceright, NAME_bracketleft, NAME_bracketright, NAME_breve, NAME_brokenbar, NAME_bullet, NAME_c, NAME_C, NAME_caron, NAME_ccedilla, NAME_Ccedilla, NAME_cedilla, NAME_cent, NAME_circumflex, NAME_colon, NAME_comma, NAME_copyright, NAME_currency, NAME_d, NAME_D, NAME_dagger, NAME_daggerdbl, NAME_degree, NAME_dieresis, NAME_divide, NAME_dollar, NAME_dotaccent, NAME_dotlessi, NAME_e, NAME_E, NAME_eacute, NAME_Eacute, NAME_ecircumflex, NAME_Ecircumflex, NAME_edieresis, NAME_Edieresis, NAME_egrave, NAME_Egrave, NAME_eight, NAME_ellipsis, NAME_emdash, NAME_endash, NAME_equal, NAME_eth, NAME_Eth, NAME_Euro, NAME_exclam, NAME_exclamdown, NAME_f, NAME_F, NAME_fi, NAME_five, NAME_fl, NAME_florin, NAME_four, NAME_fraction, NAME_g, NAME_G, NAME_germandbls, NAME_grave, NAME_greater, NAME_guillemotleft, NAME_guillemotright, NAME_guilsinglleft, NAME_guilsinglright, NAME_h, NAME_H, NAME_hungarumlaut, NAME_hyphen, NAME_i, NAME_I, NAME_iacute, NAME_Iacute, NAME_icircumflex, NAME_Icircumflex, NAME_idieresis, NAME_Idieresis, NAME_igrave, NAME_Igrave, NAME_j, NAME_J, NAME_k, NAME_K, NAME_l, NAME_L, NAME_less, NAME_logicalnot, NAME_lslash, NAME_Lslash, NAME_m, NAME_M, NAME_macron, NAME_minus, NAME_mu, NAME_multiply, NAME_n, NAME_N, NAME_nine, NAME_ntilde, NAME_Ntilde, NAME_numbersign, NAME_o, NAME_O, NAME_oacute, NAME_Oacute, NAME_ocircumflex, NAME_Ocircumflex, NAME_odieresis, NAME_Odieresis, NAME_oe, NAME_OE, NAME_ogonek, NAME_ograve, NAME_Ograve, NAME_one, NAME_onehalf, NAME_onequarter, NAME_onesuperior, NAME_ordfeminine, NAME_ordmasculine, NAME_oslash, NAME_Oslash, NAME_otilde, NAME_Otilde, NAME_p, NAME_P, NAME_paragraph, NAME_parenleft, NAME_parenright, NAME_percent, NAME_period, NAME_periodcentered, NAME_perthousand, NAME_plus, NAME_plusminus, NAME_q, NAME_Q, NAME_question, NAME_questiondown, NAME_quotedbl, NAME_quotedblbase, NAME_quotedblleft, NAME_quotedblright, NAME_quoteleft, NAME_quoteright, NAME_quotesinglbase, NAME_quotesingle, NAME_r, NAME_R, NAME_registered, NAME_ring, NAME_s, NAME_S, NAME_scaron, NAME_Scaron, NAME_section, NAME_semicolon, NAME_seven, NAME_six, NAME_slash, NAME_space, NAME_sterling, NAME_t, NAME_T, NAME_thorn, NAME_Thorn, NAME_three, NAME_threequarters, NAME_threesuperior, NAME_tilde, NAME_trademark, NAME_two, NAME_twosuperior, NAME_u, NAME_U, NAME_uacute, NAME_Uacute, NAME_ucircumflex, NAME_Ucircumflex, NAME_udieresis, NAME_Udieresis, NAME_ugrave, NAME_Ugrave, NAME_underscore, NAME_v, NAME_V, NAME_w, NAME_W, NAME_x, NAME_X, NAME_y, NAME_Y, NAME_yacute, NAME_Yacute, NAME_ydieresis, NAME_Ydieresis, NAME_yen, NAME_z, NAME_Z, NAME_zcaron, NAME_Zcaron, NAME_zero
 
Constructor Summary
DifferenceEncoding()
          DictionaryEncoding constructor comment.
 
Method Summary
static Encoding create(COSDictionary dict, PDFont font)
          Create the difference encoding from the values defined in the dict.
 int getByteCode(int unicode)
          Get the byte code point where the character referenced by the Unicode code point unicode is mapped in this font encoding or -1 if invalid.
 int getByteCode(String name)
          Get the code point where the character referenced by the Adobe glyph name name is mapped in this font encoding or -1 if not valid.
 COSObject getCosObject()
          Get an object that can be used as a representation of the receiver encoding within doc.
 String getDifferenceGlyphName(int codePoint)
           
 int getDifferenceUnicode(int codePoint)
           
 String getGlyphName(int codePoint)
          Get the character name for a given encoded byte code point.
 String getName()
           
 int getUnicode(int byteCode)
          Get the Unicode code point for the encoded code Point byteCode or -1 if not available.
 int getValidByteCode(int unicode)
          Get the byte code point where the character referenced by the Unicode code point unicode is mapped in this font encoding or a valid replacement code point if invalid.
 int getValidByteCode(String name)
          Get the code point where the character referenced by the Adobe glyph name name is mapped in this font encoding or a valid replacement.
 boolean isFontSpecificEncoding()
          Answer true if this encoding is specific to and embedded into the font program itself so that we can not derive any mapping information from here.
 
Methods inherited from class de.intarsys.pdf.encoding.Encoding
create, createReader, createWriter, decode, encode, encode, getStandard, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DK_Differences

public static final COSName DK_Differences

DK_BaseEncoding

public static final COSName DK_BaseEncoding
Constructor Detail

DifferenceEncoding

public DifferenceEncoding()
DictionaryEncoding constructor comment.

Method Detail

create

public static Encoding create(COSDictionary dict,
                              PDFont font)
Create the difference encoding from the values defined in the dict.

todo 2 remove dependency to font and refactor

Parameters:
dict - The dictionary defining the difference.
font - The font defining the base encoding.
Returns:
The difference encoding from the values defined in the dict.

getByteCode

public int getByteCode(String name)
Description copied from class: Encoding
Get the code point where the character referenced by the Adobe glyph name name is mapped in this font encoding or -1 if not valid.

name must be a valid Adobe glyph name. The code point is a value from 0...255. If the glyph is not found, -1 is returned.

Specified by:
getByteCode in class Encoding
Parameters:
name - The glyph name.
Returns:
The index from 0..255 where this character is mapped or -1.

getDifferenceUnicode

public int getDifferenceUnicode(int codePoint)
Overrides:
getDifferenceUnicode in class Encoding

getByteCode

public int getByteCode(int unicode)
Description copied from class: Encoding
Get the byte code point where the character referenced by the Unicode code point unicode is mapped in this font encoding or -1 if invalid.

unicode must be a valid Unicode code point. The returned code point is a value from 0...255. If the Unicode code point is not valid or not mapped, -1 is returned.

Specified by:
getByteCode in class Encoding
Parameters:
unicode - The Unicode code point to look up.
Returns:
The index from 0..255 where this character is mapped or -1.

getCosObject

public COSObject getCosObject()
Description copied from class: Encoding
Get an object that can be used as a representation of the receiver encoding within doc.

Specified by:
getCosObject in class Encoding
Returns:
Get an object that can be used as a representation of the receiver encoding within doc.

getGlyphName

public String getGlyphName(int codePoint)
Description copied from class: Encoding
Get the character name for a given encoded byte code point. If no mapping is defined, return ".notdef".

Specified by:
getGlyphName in class Encoding
Parameters:
codePoint - The encoded byte code point.
Returns:
The glyph name of the character referenced by codePoint or ".notdef".

getDifferenceGlyphName

public String getDifferenceGlyphName(int codePoint)
Overrides:
getDifferenceGlyphName in class Encoding

getName

public String getName()
Specified by:
getName in class Encoding

getUnicode

public int getUnicode(int byteCode)
Description copied from class: Encoding
Get the Unicode code point for the encoded code Point byteCode or -1 if not available.

Specified by:
getUnicode in class Encoding
Parameters:
byteCode - The encoded code point
Returns:
The Unicode code point for the encoded code Point byteCode or -1.

getValidByteCode

public int getValidByteCode(String name)
Description copied from class: Encoding
Get the code point where the character referenced by the Adobe glyph name name is mapped in this font encoding or a valid replacement.

name must be a valid Adobe glyph name. The code point is a value from 0...255. If the glyph is not found, a valif replacement code point is returned instead (for example the space character).

Specified by:
getValidByteCode in class Encoding
Parameters:
name - The glyph name.
Returns:
The index from 0..255 where this character is mapped or a valid replacement.

getValidByteCode

public int getValidByteCode(int unicode)
Description copied from class: Encoding
Get the byte code point where the character referenced by the Unicode code point unicode is mapped in this font encoding or a valid replacement code point if invalid.

unicode must be a valid Unicode code point. The returned code point is a value from 0...255. If the Unicode code point is not valid or not mapped, a valid code point is returned is returned (for example the space character).

Specified by:
getValidByteCode in class Encoding
Parameters:
unicode - The Unicode code point to look up.
Returns:
The index from 0..255 where this character is mapped or valid replacement.

isFontSpecificEncoding

public boolean isFontSpecificEncoding()
Description copied from class: Encoding
Answer true if this encoding is specific to and embedded into the font program itself so that we can not derive any mapping information from here.

Overrides:
isFontSpecificEncoding in class Encoding
Returns:
Answer true if this encoding is specific to and embedded into the font program itself

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.