phelps.awt.font
public class NFontType1 extends NFontSimple implements Cloneable
Features:
subsetting
re-encoding
PFA into more compact PFB
, PFA/PFB into format suitable for PDF
Implementation notes:
Version: $Revision: 1.71 $ $Date: 2004/01/14 04:55:36 $
See Also: "Adobe Type 1 Font Format"
Field Summary | |
---|---|
static String | FORMAT Type 1 format (non Compact). |
static String | FORMAT_CFF Compact Font Format aka Type 2 aka Type 1C. |
static String | SUBFORMAT_CFF_CID CID-keyed CFF. |
static String | SUBFORMAT_DECRYPTED Decrypted and no segments and no trialing 512 "0"s. |
static String | SUBFORMAT_PDF Encrypted and no segments, as found in PDF files. |
static String | SUBFORMAT_PFA Encrypted portion as ASCII hex character pairs. |
static String | SUBFORMAT_PFB Encrypted and segmented. |
Constructor Summary | |
---|---|
NFontType1(byte[] data, Map<Object,Object> afm)
Creates instance of Type 1 font given data, automatically determining subformat (PFA, PFB, PDF, CFF, or CID).
|
Method Summary | |
---|---|
boolean | canDisplayEchar(char ech) |
NFontType1 | deriveFont(float pointsize) |
NFontType1 | deriveFont(Encoding encoding, CMap toUnicode) |
NFontType1 | deriveFont(boolean[] keep)
Creates font with subset of characters.
|
void | drawEstring(Graphics2D g, String estr, float x, float y, int mode) |
void | drawString(Graphics2D g, String estr, float x, float y) |
double | echarWidth(char ech) |
int | getCharstringType() |
static int | getClen(byte[] data) |
String | getCopyright() |
String | getFamily() |
int | getFlags() |
String | getFormat() |
String | getName() |
int | getNumGlyphs() |
int | getPaintType() |
char | getSpaceChar() |
String | getSubformat() |
int | getWeight() |
static void | main(String[] argv) |
static byte[] | normalize(byte[] data)
Normalizes Type 1 (not CFF) data by removing PFB/PFA wrapping, decrypting, and removing trailing 512 00s, if any.
|
static byte[] | toPDF(byte[] data) Converts normalized data into format used in PDF (encrypted, no segments). |
byte[] | toPDF()
Exports instantiated font, probably subsetted, in PDF format (encrypted, no segments). |
static byte[] | toPFA(byte[] data)
Converts normalized data into PFB format
This consists of appending 512 00s, encrypting, and writing the encrypted portion as ASCII hex digits.
|
static byte[] | toPFB(byte[] data)
Converts normalized data into PFB format
This consists of appending 512 00s, encrypting, and wrapping in PFB.
|
Note: Data from non-byte[]
sources can be easily converted,
from a java.io.File with Files
or from a java.io.InputStream with InputStreams.
data may be mutated.
null
, subset consists of all characters defined in current encoding.
After subsetting, this fact is indicated by prefixing font name with six random capital letters and a plus sign.Parameters: keep is a vector of flags such that keep[char_num]==true iff that character is a member of the subset.
-1
and it will be computed.
normalized
data into format used in PDF (encrypted, no segments).normalized
data into PFB format
This consists of appending 512 00s, encrypting, and writing the encrypted portion as ASCII hex digits.
(Does not translate from CFF.)normalized
data into PFB format
This consists of appending 512 00s, encrypting, and wrapping in PFB.
(Does not translate from CFF.)