Package org.verapdf.pd.font
Class PDFontDescriptor
java.lang.Object
org.verapdf.pd.PDObject
org.verapdf.pd.font.PDFontDescriptor
Represents font descriptor.
- Author:
- Sergey Shemyakov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanParseFontFile(ASAtom key) Checks if specific font program can be read from this font descriptor.static PDFontDescriptorConstructs font descriptor for given standard font metrics.getFlags()double[]getStemH()getStemV()booleanisAllCap()booleanbooleanbooleanisItalic()booleanbooleanisScript()booleanisSerif()booleanbooleanvoidvoidvoidsetAvgWidth(Double avgWidth) voidsetCapHeight(Double capHeight) voidsetCharSet(String charSet) voidsetDescent(Double descent) voidsetFixedPitch(Boolean fixedPitch) voidsetFontBoundingBox(double[] fontBoundingBox) voidsetFontFamily(String fontFamily) voidsetFontName(ASAtom fontName) voidsetFontStretch(ASAtom fontStretch) voidsetFontWeight(Double fontWeight) voidsetForceBold(Boolean forceBold) voidvoidsetItalicAngle(Double italicAngle) voidsetLeading(Double leading) voidsetMaxWidth(Double maxWidth) voidsetMissingWidth(Double missingWidth) voidsetNonSymblic(Boolean nonSymblic) voidvoidvoidsetSmallCup(Boolean smallCup) voidvoidvoidsetSymbolic(Boolean symbolic) voidsetxHeight(Double xHeight) Methods inherited from class org.verapdf.pd.PDObject
clear, empty, getBooleanKey, getIntegerKey, getKey, getNameKey, getNameKeyStringValue, getObject, getRealKey, getStringKey, knownKey, removeKey, setBooleanKey, setIntegerKey, setKey, setNameKey, setObject, setObject, setStringKey, updateFromObject, updateToObject
-
Constructor Details
-
PDFontDescriptor
Constructor from font descriptor COSObject.- Parameters:
obj- is descriptor COSObject.
-
-
Method Details
-
getFlags
- Returns:
- a collection of flags defining various characteristics of the font.
-
getFontName
- Returns:
- the PostScript name of the font.
-
getFontFamily
- Returns:
- a byte string specifying the preferred font family name.
-
getFontStretch
- Returns:
- the font stretch value.
-
getFontWeight
- Returns:
- the weight (thickness) component of the fully-qualified font name or font specifier.
-
isFixedPitch
public boolean isFixedPitch()- Returns:
- true if all glyphs have the same width.
-
isSerif
public boolean isSerif()- Returns:
- true if glyphs have serifs, which are short strokes drawn at an angle on the top and bottom of glyph stems.
-
isSymbolic
public boolean isSymbolic()- Returns:
- true if font contains glyphs outside the Adobe standard Latin character set.
-
isScript
public boolean isScript()- Returns:
- true if glyphs resemble cursive handwriting.
-
isNonsymbolic
public boolean isNonsymbolic()- Returns:
- true if font uses the Adobe standard Latin character set or a subset of it.
-
isItalic
public boolean isItalic()- Returns:
- true if glyphs have dominant vertical strokes that are slanted.
-
isAllCap
public boolean isAllCap()- Returns:
- true if font contains no lowercase letters; typically used for display purposes, such as for titles or headlines.
-
isSmallCap
public boolean isSmallCap()- Returns:
- true if font contains both uppercase and lowercase letters.
-
isForceBold
public boolean isForceBold()- Returns:
- true if bold glyphs shall be painted with extra pixels even at very small text sizes by a conforming reader.
-
getFontBoundingBox
public double[] getFontBoundingBox()- Returns:
- a rectangle, expressed in the glyph coordinate system, that shall specify the font bounding box.
-
getItalicAngle
- Returns:
- the angle, expressed in degrees counterclockwise from the vertical, of the dominant vertical strokes of the font.
-
getAscent
- Returns:
- the maximum height above the baseline reached by glyphs in this font.
-
getDescent
- Returns:
- the maximum depth below the baseline reached by glyphs in this font.
-
getLeading
- Returns:
- the spacing between baselines of consecutive lines of text.
-
getCapHeight
- Returns:
- the vertical coordinate of the top of flat capital letters, measured from the baseline.
-
getXHeight
- Returns:
- the font’s x height: the vertical coordinate of the top of flat nonascending lowercase letters (like the letter x), measured from the baseline, in fonts that have Latin characters.
-
getStemV
- Returns:
- the thickness, measured horizontally, of the dominant vertical stems of glyphs in the font.
-
getStemH
- Returns:
- the thickness, measured vertically, of the dominant horizontal stems of glyphs in the font.
-
getAvgWidth
- Returns:
- the average width of glyphs in the font.
-
getMaxWidth
- Returns:
- the maximum width of glyphs in the font.
-
getMissingWidth
- Returns:
- the width to use for character codes whose widths are not specified in a font dictionary’s Widths array.
-
getCharSet
- Returns:
- a string listing the character names defined in a font subset.
-
getFontFile
- Returns:
- a stream containing a Type 1 font program.
-
getFontFile2
- Returns:
- a stream containing a TrueType font program.
-
getFontFile3
- Returns:
- a stream containing a font program whose format is specified by the Subtype entry in the stream dictionary.
-
canParseFontFile
Checks if specific font program can be read from this font descriptor.- Parameters:
key- is key of font program in font descriptor dictionary, e.g. FontFile or FontFile2.- Returns:
- true if value with this key exists and is a COSStream.
-
setFontName
-
setFontFamily
-
setFontStretch
-
setFontWeight
-
setFixedPitch
-
setSerif
-
setSymbolic
-
setScript
-
setNonSymblic
-
setItalic
-
setAllCap
-
setSmallCup
-
setForceBold
-
setFontBoundingBox
public void setFontBoundingBox(double[] fontBoundingBox) -
setItalicAngle
-
setAscent
-
setDescent
-
setLeading
-
setCapHeight
-
setxHeight
-
setStemV
-
setStemH
-
setAvgWidth
-
setMaxWidth
-
setMissingWidth
-
setCharSet
-
getDescriptorFromMetrics
Constructs font descriptor for given standard font metrics.- Parameters:
sfm- is standard font metrics.- Returns:
- font descriptor with fields set in accordance with sfm.
-