|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.lowagie.text.pdf.BaseFont
com.lowagie.text.pdf.TrueTypeFont
com.lowagie.text.pdf.TrueTypeFontUnicode
class TrueTypeFontUnicode
Represents a True Type font with Unicode encoding. All the character in the font can be used directly by using the encoding Identity-H or Identity-V. This is the only way to represent some character sets such as Thai.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.lowagie.text.pdf.TrueTypeFont |
|---|
TrueTypeFont.FontHeader, TrueTypeFont.HorizontalHeader, TrueTypeFont.WindowsMetrics |
| Nested classes/interfaces inherited from class com.lowagie.text.pdf.BaseFont |
|---|
BaseFont.StreamFont |
| Field Summary | |
|---|---|
private static byte[] |
rotbits
|
(package private) boolean |
vertical
true if the encoding is vertical. |
| Fields inherited from class com.lowagie.text.pdf.TrueTypeFont |
|---|
allNameEntries, bboxes, cff, cffLength, cffOffset, cmap10, cmap31, cmapExt, codePages, directoryOffset, familyName, fileName, fontName, fullName, GlyphWidths, head, hhea, isFixedPitch, italicAngle, justNames, kerning, os_2, rf, style, tables, ttcIndex, underlinePosition, underlineThickness |
| Constructor Summary | |
|---|---|
TrueTypeFontUnicode(String ttFile,
String enc,
boolean emb,
byte[] ttfAfm)
Creates a new TrueType font addressed by Unicode characters. |
|
| Method Summary | |
|---|---|
boolean |
charExists(int c)
Checks if a character exists in this font. |
int |
compare(Object o1,
Object o2)
The method used to sort the metrics array. |
(package private) byte[] |
convertToBytes(int char1)
Converts a char to a byte array according
to the font's encoding. |
(package private) byte[] |
convertToBytes(String text)
A forbidden operation. |
int[] |
getCharBBox(char c)
|
private PdfDictionary |
getCIDFontType2(PdfIndirectReference fontDescriptor,
String subsetPrefix,
Object[] metrics)
Generates the CIDFontTyte2 dictionary. |
private PdfDictionary |
getFontBaseType(PdfIndirectReference descendant,
String subsetPrefix,
PdfIndirectReference toUnicode)
Generates the font dictionary. |
int[] |
getMetricsTT(int c)
Gets the glyph index and metrics for a character. |
private PdfStream |
getToUnicode(Object[] metrics)
Creates a ToUnicode CMap to allow copy and paste from Acrobat. |
int |
getWidth(int char1)
Gets the width of a char in normalized 1000 units. |
int |
getWidth(String text)
Gets the width of a String in normalized 1000 units. |
boolean |
setCharAdvance(int c,
int advance)
Sets the character advance. |
(package private) static String |
toHex(int n)
Gets an hex string in the format "<HHHH>". |
private static String |
toHex4(int n)
|
(package private) void |
writeFont(PdfWriter writer,
PdfIndirectReference ref,
Object[] params)
Outputs to the writer the font dictionaries and streams. |
| Methods inherited from class com.lowagie.text.pdf.TrueTypeFont |
|---|
addRangeUni, checkCff, compactRanges, fillTables, getAllNameEntries, getAllNames, getBaseFont, getCodePagesSupported, getFamilyFontName, getFontBaseType, getFontDescriptor, getFontDescriptor, getFullFont, getFullFontName, getGlyphWidth, getKerning, getNames, getPostscriptFontName, getRawCharBBox, getRawWidth, getTTCName, hasKernPairs, process, readCMaps, readFormat0, readFormat12, readFormat4, readFormat6, readGlyphWidths, readKerning, readStandardString, readUnicodeString, setKerning, setPostscriptFontName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
|---|
equals |
| Field Detail |
|---|
boolean vertical
true if the encoding is vertical.
private static final byte[] rotbits
| Constructor Detail |
|---|
TrueTypeFontUnicode(String ttFile,
String enc,
boolean emb,
byte[] ttfAfm)
throws DocumentException,
IOException
ttFile - the location of the font on file. The file must end in '.ttf'.
The modifiers after the name are ignored.enc - the encoding to be applied to this fontemb - true if the font is to be embedded in the PDFttfAfm - the font as a byte array
DocumentException - the font is invalid
IOException - the font file could not be read| Method Detail |
|---|
public int getWidth(int char1)
char in normalized 1000 units.
getWidth in class BaseFontchar1 - the unicode char to get the width of
public int getWidth(String text)
String in normalized 1000 units.
getWidth in class BaseFonttext - the String to get the width of
private PdfStream getToUnicode(Object[] metrics)
metrics - metrics[0] contains the glyph index and metrics[2]
contains the Unicode code
null
DocumentException - on errorprivate static String toHex4(int n)
static String toHex(int n)
n - the number
private PdfDictionary getCIDFontType2(PdfIndirectReference fontDescriptor,
String subsetPrefix,
Object[] metrics)
fontDescriptor - the indirect reference to the font descriptorsubsetPrefix - the subset prefixmetrics - the horizontal width metrics
private PdfDictionary getFontBaseType(PdfIndirectReference descendant,
String subsetPrefix,
PdfIndirectReference toUnicode)
descendant - the descendant dictionarysubsetPrefix - the subset prefixtoUnicode - the ToUnicode stream
public int compare(Object o1,
Object o2)
compare in interface Comparatoro1 - the first elemento2 - the second element
void writeFont(PdfWriter writer,
PdfIndirectReference ref,
Object[] params)
throws DocumentException,
IOException
writeFont in class TrueTypeFontwriter - the writer for this documentref - the font indirect referenceparams - several parameters that depend on the font type
IOException - on error
DocumentException - error in generating the objectbyte[] convertToBytes(String text)
convertToBytes in class BaseFonttext - the text
nullbyte[] convertToBytes(int char1)
BaseFontchar to a byte array according
to the font's encoding.
convertToBytes in class BaseFontchar1 - the char to be converted
byte representing the conversion according to the font's encodingpublic int[] getMetricsTT(int c)
getMetricsTT in class TrueTypeFontc - the character
int array with {glyph index, width}public boolean charExists(int c)
charExists in class BaseFontc - the character to check
true if the character has a glyph,
false otherwise
public boolean setCharAdvance(int c,
int advance)
setCharAdvance in class BaseFontc - the characteradvance - the character advance normalized to 1000 units
true if the advance was set,
false otherwisepublic int[] getCharBBox(char c)
|
Hosted by Hostbasket | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||