Class PCLTTFFontReader
- java.lang.Object
-
- org.apache.fop.render.pcl.fonts.PCLFontReader
-
- org.apache.fop.render.pcl.fonts.truetype.PCLTTFFontReader
-
public class PCLTTFFontReader extends PCLFontReader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPCLTTFFontReader.TableOffset
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,java.lang.Integer>charMtxOffsetsprivate java.util.Map<java.lang.Integer,int[]>charOffsetsprivate static java.util.Map<java.lang.Integer,java.lang.Integer>FONT_SERIFprivate static java.util.Map<java.lang.Integer,java.lang.Integer>FONT_WEIGHTprivate static java.util.Map<java.lang.Integer,java.lang.Integer>FONT_WIDTHprotected java.io.InputStreamfontStreamprivate static intHMTX_RESTRICT_SIZEprivate PCLTTFOS2FontTableos2Tableprivate PCLTTFPCLTFontTablepcltTableprivate PCLTTFPOSTFontTablepostTableprotected FontFileReaderreaderprivate intscaleFactorprivate PCLSymbolSetsymbolSetprotected TTFFilettfFontprivate PCLTTFTableFactoryttfTableFactory-
Fields inherited from class org.apache.fop.render.pcl.fonts.PCLFontReader
font, typeface
-
-
Constructor Summary
Constructors Constructor Description PCLTTFFontReader(Typeface font)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private intconvertFromTTFSerifStyle()private intconvertTTFWeightClass(int weightClass)private intconvertTTFWidthClass(int widthClass)private java.io.ByteArrayOutputStreamcopyTables(java.util.List<PCLTTFFontReader.TableOffset> tableOffsets, java.io.ByteArrayOutputStream baos, byte[] hmtxTable, int hmtxSize)protected byte[]createHmtx(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs)intgetBaselinePosition()intgetCapHeight()intgetCellHeight()intgetCellWidth()private byte[]getCharacterComplement()See Font Header Format 11-35 (Character Complement Array) in the PCL 5 Specification.java.util.Map<java.lang.Integer,int[]>getCharacterOffsets()Character Definitionsprotected static intgetCheckSum(byte[] data, int start, int size)intgetDescriptorSize()Header DataintgetFirstCode()OpenFontgetFontFile()FontFileReadergetFontFileReader()java.lang.StringgetFontName()intgetFontNumber()intgetFontScalingTechnology()java.util.List<PCLFontSegment>getFontSegments(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs)Segmented Font DataintgetFontType()private byte[]getGlobalTrueTypeData(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs)intgetHeaderFormat()intgetHeight()intgetHeightExtended()intgetLastCode()intgetMasterUnderlinePosition()intgetMasterUnderlineThickness()intgetOrientation()intgetPitch()intgetPitchExtended()intgetPlacement()intgetQuality()intgetScaleFactor()intgetSerifStyle()intgetSpacing()intgetStrokeWeight()intgetStyleLSB()intgetStyleMSB()intgetSymbolSet()intgetTextHeight()intgetTextWidth()private PCLTTFTableFactorygetTTFTableFactory()intgetTypefaceLSB()intgetTypefaceMSB()intgetUnderlinePosition()intgetUnderlineThickness()intgetVariety()intgetWidthType()intgetXHeight()protected voidloadFont()private PCLTTFTablereadFontTable(OFTableName tableName)protected voidreadFontTables()java.util.Map<java.lang.Integer,java.lang.Integer>scanMtxCharacters()private byte[]updateHHEA(byte[] tableData, int hmtxSize)private java.io.ByteArrayOutputStreamupdateOffsets(java.io.ByteArrayOutputStream baos, java.util.Map<java.lang.Integer,byte[]> offsets)private voidwriteGDIR(java.io.ByteArrayOutputStream baos)private voidwriteSubsetHMTX(java.io.ByteArrayOutputStream baos, OFTableName table, java.util.List<PCLTTFFontReader.TableOffset> tableOffsets, byte[] hmtxTable)private voidwriteTrueTypeTable(java.io.ByteArrayOutputStream baos, OFTableName table, java.util.List<PCLTTFFontReader.TableOffset> tableOffsets)private voidwriteUShort(byte[] out, int offset, int s)Appends a USHORT to the output array, updates currentPost but not realSize-
Methods inherited from class org.apache.fop.render.pcl.fonts.PCLFontReader
getLSB, getMSB, setFont
-
-
-
-
Field Detail
-
ttfFont
protected TTFFile ttfFont
-
fontStream
protected java.io.InputStream fontStream
-
reader
protected FontFileReader reader
-
pcltTable
private PCLTTFPCLTFontTable pcltTable
-
os2Table
private PCLTTFOS2FontTable os2Table
-
postTable
private PCLTTFPOSTFontTable postTable
-
ttfTableFactory
private PCLTTFTableFactory ttfTableFactory
-
charOffsets
private java.util.Map<java.lang.Integer,int[]> charOffsets
-
charMtxOffsets
private java.util.Map<java.lang.Integer,java.lang.Integer> charMtxOffsets
-
HMTX_RESTRICT_SIZE
private static final int HMTX_RESTRICT_SIZE
- See Also:
- Constant Field Values
-
FONT_WEIGHT
private static final java.util.Map<java.lang.Integer,java.lang.Integer> FONT_WEIGHT
-
FONT_SERIF
private static final java.util.Map<java.lang.Integer,java.lang.Integer> FONT_SERIF
-
FONT_WIDTH
private static final java.util.Map<java.lang.Integer,java.lang.Integer> FONT_WIDTH
-
scaleFactor
private int scaleFactor
-
symbolSet
private PCLSymbolSet symbolSet
-
-
Constructor Detail
-
PCLTTFFontReader
public PCLTTFFontReader(Typeface font) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
loadFont
protected void loadFont() throws java.io.IOException- Throws:
java.io.IOException
-
readFontTables
protected void readFontTables() throws java.io.IOException- Throws:
java.io.IOException
-
readFontTable
private PCLTTFTable readFontTable(OFTableName tableName) throws java.io.IOException
- Throws:
java.io.IOException
-
getTTFTableFactory
private PCLTTFTableFactory getTTFTableFactory()
-
getDescriptorSize
public int getDescriptorSize()
Description copied from class:PCLFontReaderHeader Data- Specified by:
getDescriptorSizein classPCLFontReader
-
getHeaderFormat
public int getHeaderFormat()
- Specified by:
getHeaderFormatin classPCLFontReader
-
getFontType
public int getFontType()
- Specified by:
getFontTypein classPCLFontReader
-
getStyleMSB
public int getStyleMSB()
- Specified by:
getStyleMSBin classPCLFontReader
-
getBaselinePosition
public int getBaselinePosition()
- Specified by:
getBaselinePositionin classPCLFontReader
-
getCellWidth
public int getCellWidth()
- Specified by:
getCellWidthin classPCLFontReader
-
getCellHeight
public int getCellHeight()
- Specified by:
getCellHeightin classPCLFontReader
-
getOrientation
public int getOrientation()
- Specified by:
getOrientationin classPCLFontReader
-
getSpacing
public int getSpacing()
- Specified by:
getSpacingin classPCLFontReader
-
getSymbolSet
public int getSymbolSet()
- Specified by:
getSymbolSetin classPCLFontReader
-
getPitch
public int getPitch()
- Specified by:
getPitchin classPCLFontReader
-
getHeight
public int getHeight()
- Specified by:
getHeightin classPCLFontReader
-
getXHeight
public int getXHeight()
- Specified by:
getXHeightin classPCLFontReader
-
getWidthType
public int getWidthType()
- Specified by:
getWidthTypein classPCLFontReader
-
convertTTFWidthClass
private int convertTTFWidthClass(int widthClass)
-
getStyleLSB
public int getStyleLSB()
- Specified by:
getStyleLSBin classPCLFontReader
-
getStrokeWeight
public int getStrokeWeight()
- Specified by:
getStrokeWeightin classPCLFontReader
-
convertTTFWeightClass
private int convertTTFWeightClass(int weightClass)
-
getTypefaceLSB
public int getTypefaceLSB()
- Specified by:
getTypefaceLSBin classPCLFontReader
-
getTypefaceMSB
public int getTypefaceMSB()
- Specified by:
getTypefaceMSBin classPCLFontReader
-
getSerifStyle
public int getSerifStyle()
- Specified by:
getSerifStylein classPCLFontReader
-
convertFromTTFSerifStyle
private int convertFromTTFSerifStyle()
-
getQuality
public int getQuality()
- Specified by:
getQualityin classPCLFontReader
-
getPlacement
public int getPlacement()
- Specified by:
getPlacementin classPCLFontReader
-
getUnderlinePosition
public int getUnderlinePosition()
- Specified by:
getUnderlinePositionin classPCLFontReader
-
getUnderlineThickness
public int getUnderlineThickness()
- Specified by:
getUnderlineThicknessin classPCLFontReader
-
getTextHeight
public int getTextHeight()
- Specified by:
getTextHeightin classPCLFontReader
-
getTextWidth
public int getTextWidth()
- Specified by:
getTextWidthin classPCLFontReader
-
getFirstCode
public int getFirstCode()
- Specified by:
getFirstCodein classPCLFontReader
-
getLastCode
public int getLastCode()
- Specified by:
getLastCodein classPCLFontReader
-
getPitchExtended
public int getPitchExtended()
- Specified by:
getPitchExtendedin classPCLFontReader
-
getHeightExtended
public int getHeightExtended()
- Specified by:
getHeightExtendedin classPCLFontReader
-
getCapHeight
public int getCapHeight()
- Specified by:
getCapHeightin classPCLFontReader
-
getFontNumber
public int getFontNumber()
- Specified by:
getFontNumberin classPCLFontReader
-
getFontName
public java.lang.String getFontName()
- Specified by:
getFontNamein classPCLFontReader
-
getScaleFactor
public int getScaleFactor() throws java.io.IOException- Specified by:
getScaleFactorin classPCLFontReader- Throws:
java.io.IOException
-
getMasterUnderlinePosition
public int getMasterUnderlinePosition() throws java.io.IOException- Specified by:
getMasterUnderlinePositionin classPCLFontReader- Throws:
java.io.IOException
-
getMasterUnderlineThickness
public int getMasterUnderlineThickness() throws java.io.IOException- Specified by:
getMasterUnderlineThicknessin classPCLFontReader- Throws:
java.io.IOException
-
getFontScalingTechnology
public int getFontScalingTechnology()
- Specified by:
getFontScalingTechnologyin classPCLFontReader
-
getVariety
public int getVariety()
- Specified by:
getVarietyin classPCLFontReader
-
getFontSegments
public java.util.List<PCLFontSegment> getFontSegments(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs) throws java.io.IOException
Description copied from class:PCLFontReaderSegmented Font Data- Specified by:
getFontSegmentsin classPCLFontReader- Throws:
java.io.IOException
-
getCharacterComplement
private byte[] getCharacterComplement()
See Font Header Format 11-35 (Character Complement Array) in the PCL 5 Specification. Defined as an array of 8 bytes specific to certain character sets. In this case specifying 0 for all values (default complement) means the font is compatible with any character sets. '110' on least significant bits signifies unicode. See specification for further customization.
-
getGlobalTrueTypeData
private byte[] getGlobalTrueTypeData(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs) throws java.io.IOException- Throws:
java.io.IOException
-
writeTrueTypeTable
private void writeTrueTypeTable(java.io.ByteArrayOutputStream baos, OFTableName table, java.util.List<PCLTTFFontReader.TableOffset> tableOffsets) throws java.io.IOException- Throws:
java.io.IOException
-
writeGDIR
private void writeGDIR(java.io.ByteArrayOutputStream baos) throws java.io.IOException- Throws:
java.io.IOException
-
copyTables
private java.io.ByteArrayOutputStream copyTables(java.util.List<PCLTTFFontReader.TableOffset> tableOffsets, java.io.ByteArrayOutputStream baos, byte[] hmtxTable, int hmtxSize) throws java.io.IOException
- Throws:
java.io.IOException
-
updateHHEA
private byte[] updateHHEA(byte[] tableData, int hmtxSize)
-
updateOffsets
private java.io.ByteArrayOutputStream updateOffsets(java.io.ByteArrayOutputStream baos, java.util.Map<java.lang.Integer,byte[]> offsets) throws java.io.IOException- Throws:
java.io.IOException
-
getCharacterOffsets
public java.util.Map<java.lang.Integer,int[]> getCharacterOffsets() throws java.io.IOExceptionDescription copied from class:PCLFontReaderCharacter Definitions- Specified by:
getCharacterOffsetsin classPCLFontReader- Throws:
java.io.IOException
-
getFontFile
public OpenFont getFontFile()
- Specified by:
getFontFilein classPCLFontReader
-
getFontFileReader
public FontFileReader getFontFileReader()
- Specified by:
getFontFileReaderin classPCLFontReader
-
writeSubsetHMTX
private void writeSubsetHMTX(java.io.ByteArrayOutputStream baos, OFTableName table, java.util.List<PCLTTFFontReader.TableOffset> tableOffsets, byte[] hmtxTable) throws java.io.IOException- Throws:
java.io.IOException
-
getCheckSum
protected static int getCheckSum(byte[] data, int start, int size)
-
createHmtx
protected byte[] createHmtx(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs)
-
writeUShort
private void writeUShort(byte[] out, int offset, int s)Appends a USHORT to the output array, updates currentPost but not realSize
-
scanMtxCharacters
public java.util.Map<java.lang.Integer,java.lang.Integer> scanMtxCharacters() throws java.io.IOException- Specified by:
scanMtxCharactersin classPCLFontReader- Throws:
java.io.IOException
-
-