public class PdfFont extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allNumbers |
String |
CMapName |
protected boolean |
containsHexNumbers |
protected String |
copyright |
protected PdfObjectReader |
currentPdfFile
handle onto file access
|
protected String[] |
diffs
holds lookup to map char differences in embedded font
|
protected int |
embeddedEnc
embedded encoding
|
protected String |
embeddedFamilyName |
protected String |
embeddedFontName |
CmapSpec |
encodingCmapSpec
adobe specified cmaps used in encoding
|
float[] |
FontBBox
font bounding box
|
protected int |
fontEnc
encoding pattern used for font.
|
protected String |
fontID
String used to reference font (ie F1)
|
double[] |
FontMatrix
FontBBox for font
|
protected int |
fontTypes
font type
|
PdfJavaGlyphs |
glyphs |
boolean |
hasDoubleBytes |
protected boolean |
hasEncoding
show if encoding set
|
protected boolean |
isCIDFont
flag to show type of font
|
boolean |
isFontEmbedded
flag to show if Font included embedded data
|
protected boolean |
isFontSubstituted |
protected boolean |
isFontVertical |
protected boolean |
isHex
flag to show Gxxx, Bxxx, Cxxx.
|
protected int |
italicAngle |
protected ClassLoader |
loader
loader to load data from jar
|
protected int |
maxCharCount
number of glyphs - 65536 for CID fonts
|
protected Map<String,Integer> |
rawDiffKeys |
protected boolean |
renderPage |
protected String |
substituteFont |
protected String |
substituteFontFile |
protected boolean |
TTstreamisCID |
| Constructor and Description |
|---|
PdfFont() |
PdfFont(PdfObjectReader current_pdf_file)
get handles onto Reader so we can access the file
|
| Modifier and Type | Method and Description |
|---|---|
void |
createCIDFont(PdfObject pdfObject,
PdfObject Descendent)
generic CID code
|
void |
createFont(PdfObject pdfObject,
String fontID,
boolean renderPage,
ObjectStore objectStore,
Map<String,PdfJavaGlyphs> substitutedFonts)
read in a font and its details from the pdf file
|
String |
getBaseFontName()
get raw font name which may include +xxxxxx
|
Rectangle |
getBoundingBox()
get bounding box to highlight
|
int[] |
getCIDToGIDMap() |
String[] |
getCMAP() |
String |
getCopyright()
get the copyright information
|
float |
getCurrentFontSpaceWidth()
get width of a space
|
float |
getDefaultWidth(int idx)
returns width or value in widthTable (-1 if no width set) idx=-1 returns
default
|
float |
getDescent() |
int |
getDiffChar(int index) |
int |
getDiffChar(String glypName)
used by PDF2HTML5 where encoding different from index in TJ command and
we need to remap via glyf name (ie sample_pdf_htmls/thoughtcorp/Simple
Relational Contracts.pdf)
|
String |
getDiffMapping(int charInt)
return char mapped onto value in Differences or null
|
String |
getEmbeddedChar(int charInt) |
int |
getEncodedCMAPValue(int ptr)
looks up ptr in any CID CMAP in font
|
float[] |
getFontBounds() |
int |
getFontEncoding(boolean notNull) |
String |
getFontID() |
String |
getFontName()
get font name as a string from ID (ie Tf /F1) and load if one of Adobe 14
|
int |
getFontType()
gets type of font (ie 3 ) so we can call type specific code.
|
PdfJavaGlyphs |
getGlyphData() |
String |
getGlyphValue(int rawInt)
convert value read from TJ operand into correct glyph
Also check to see if mapped onto unicode value |
float |
getGlyphWidth(String charGlyph,
int rawInt,
String displayValue)
used in generic renderer
|
Font |
getJavaFontX(int size)
Returns the java font, initializing it first if it hasn't been used
before.
|
String |
getMappedChar(int charInt,
boolean remap)
Returns the char glyph corresponding to the specified code for the
specified font.
|
int |
getObjID() |
static String |
getSpaces(float currentGap,
float spaceWidth,
float currentThreshold)
workout spaces (if any) to add into content for a gap from user settings,
space info in pdf
|
float |
getSpaceWidthHTML()
get width of a space for HTML
|
String |
getSubstituteFont()
name of font and Path used to display
|
PdfObject |
getToUnicode() |
String |
getTruncatedName() |
String |
getUnicodeMapping(int char_int)
return unicode value for this index value
|
String |
getUnicodeValue(String displayValue,
int rawInt)
return the mapped character
|
float |
getWidth(int charInt)
Returns width of the specified character
Allows for no value set |
boolean |
hasToUnicode()
Used by HTML code to tell whether to use CID range remapping or not
|
protected void |
init(PdfObjectReader current_pdf_file)
set number of glyphs to 256 or 65536
|
protected void |
init(String fontID,
boolean renderPage) |
boolean |
is1C() |
boolean |
isBrokenFont()
workaround to handle issue with some odd SAP files Please do not use.
|
boolean |
isCIDFont()
flag if CID font
|
int |
isDoubleBytes()
flag to show if double (1), single (0) or unset (-1)
|
int |
isDoubleBytes(int firstVal,
int secondByte,
boolean secondByteIsEscaped)
work out if 1 or 2 bytes for each char
|
boolean |
isFontSubsetted() |
boolean |
isFontSubstituted()
used to show truetype used for type 0 CID
|
boolean |
isFontVertical() |
boolean |
isSingleByte() |
boolean |
isWidthVertical() |
void |
putFontEncoding(int enc)
store encoding and load required mappings
|
protected void |
putMappedChar(int charInt,
String mappedChar)
Insert a new mapped char in the name mapping table
|
void |
readWidths(PdfObject pdfObject,
boolean setSpace)
read in width values
|
void |
resetNameForHTML(String newName)
used by PDF2HTML to replace unsuitable characters and make sure unique
|
protected void |
setBoundsAndMatrix(PdfObject pdfFontDescriptor) |
void |
setDefaultDisplayFont(String fontName)
set the font used for default from Java fonts on system - check it is a
valid font (otherwise it will default to Lucida anyway)
|
protected void |
setEncoding(PdfObject pdfObject,
PdfObject pdfFontDescriptor) |
void |
setFont(String font,
int textSize) |
void |
setLastWidth(float lastWidth) |
protected void |
setName(PdfObject pdfObject) |
void |
setRawFontName(String baseFont) |
void |
setValuesForGlyph(int rawInt,
String charGlyph,
String displayValue,
String embeddedChar) |
public String CMapName
protected boolean containsHexNumbers
protected boolean allNumbers
protected String embeddedFontName
protected String embeddedFamilyName
protected String copyright
protected boolean isFontVertical
public PdfJavaGlyphs glyphs
public boolean hasDoubleBytes
public CmapSpec encodingCmapSpec
protected String substituteFont
protected boolean renderPage
protected int embeddedEnc
protected String[] diffs
public boolean isFontEmbedded
protected boolean TTstreamisCID
protected String fontID
protected int maxCharCount
protected boolean hasEncoding
protected int fontTypes
protected String substituteFontFile
protected PdfObjectReader currentPdfFile
protected final ClassLoader loader
public double[] FontMatrix
public float[] FontBBox
protected boolean isHex
protected int fontEnc
protected boolean isCIDFont
protected boolean isFontSubstituted
protected int italicAngle
public PdfFont()
public PdfFont(PdfObjectReader current_pdf_file)
public String getTruncatedName()
public boolean isFontSubstituted()
public final boolean isCIDFont()
protected final void init(PdfObjectReader current_pdf_file)
public final String getUnicodeMapping(int char_int)
public final void putFontEncoding(int enc)
public final String getUnicodeValue(String displayValue, int rawInt)
public final String getGlyphValue(int rawInt)
public final void setDefaultDisplayFont(String fontName)
public final Font getJavaFontX(int size)
public final String getFontName()
public final String getCopyright()
public final String getBaseFontName()
public final float getCurrentFontSpaceWidth()
public final float getSpaceWidthHTML()
public final int getFontEncoding(boolean notNull)
public final float getWidth(int charInt)
public void createCIDFont(PdfObject pdfObject, PdfObject Descendent) throws PdfFontException
PdfFontExceptionpublic void readWidths(PdfObject pdfObject, boolean setSpace) throws Exception
Exceptionpublic void createFont(PdfObject pdfObject, String fontID, boolean renderPage, ObjectStore objectStore, Map<String,PdfJavaGlyphs> substitutedFonts) throws Exception
Exceptionprotected void setName(PdfObject pdfObject)
public void resetNameForHTML(String newName)
newName - public int getObjID()
public float getDescent()
protected void setBoundsAndMatrix(PdfObject pdfFontDescriptor)
protected void init(String fontID, boolean renderPage)
public final int getDiffChar(String glypName)
glypName - protected final void putMappedChar(int charInt,
String mappedChar)
public String getDiffMapping(int charInt)
charInt - public final String getMappedChar(int charInt, boolean remap)
public final String getEmbeddedChar(int charInt)
public final int getFontType()
public String getSubstituteFont()
public float getGlyphWidth(String charGlyph, int rawInt, String displayValue)
public PdfJavaGlyphs getGlyphData()
public void setFont(String font, int textSize)
public boolean is1C()
public boolean isFontSubsetted()
public void setValuesForGlyph(int rawInt,
String charGlyph,
String displayValue,
String embeddedChar)
public Rectangle getBoundingBox()
public void setRawFontName(String baseFont)
public static String getSpaces(float currentGap, float spaceWidth, float currentThreshold)
public int getDiffChar(int index)
public float[] getFontBounds()
public boolean isFontVertical()
public void setLastWidth(float lastWidth)
lastWidth - public String getFontID()
public boolean isSingleByte()
public boolean isBrokenFont()
public boolean hasToUnicode()
public float getDefaultWidth(int idx)
public int isDoubleBytes(int firstVal,
int secondByte,
boolean secondByteIsEscaped)
firstVal - secondByte - secondByteIsEscaped - public int isDoubleBytes()
public PdfObject getToUnicode()
public int[] getCIDToGIDMap()
public int getEncodedCMAPValue(int ptr)
ptr - public String[] getCMAP()
public boolean isWidthVertical()
Copyright © 2017. All rights reserved.