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 class
PCLTTFFontReader.TableOffset
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Integer,java.lang.Integer>
charMtxOffsets
private java.util.Map<java.lang.Integer,int[]>
charOffsets
private static java.util.Map<java.lang.Integer,java.lang.Integer>
FONT_SERIF
private static java.util.Map<java.lang.Integer,java.lang.Integer>
FONT_WEIGHT
private static java.util.Map<java.lang.Integer,java.lang.Integer>
FONT_WIDTH
protected java.io.InputStream
fontStream
private static int
HMTX_RESTRICT_SIZE
private PCLTTFOS2FontTable
os2Table
private PCLTTFPCLTFontTable
pcltTable
private PCLTTFPOSTFontTable
postTable
protected FontFileReader
reader
private int
scaleFactor
private PCLSymbolSet
symbolSet
protected TTFFile
ttfFont
private PCLTTFTableFactory
ttfTableFactory
-
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 int
convertFromTTFSerifStyle()
private int
convertTTFWeightClass(int weightClass)
private int
convertTTFWidthClass(int widthClass)
private java.io.ByteArrayOutputStream
copyTables(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)
int
getBaselinePosition()
int
getCapHeight()
int
getCellHeight()
int
getCellWidth()
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 int
getCheckSum(byte[] data, int start, int size)
int
getDescriptorSize()
Header Dataint
getFirstCode()
OpenFont
getFontFile()
FontFileReader
getFontFileReader()
java.lang.String
getFontName()
int
getFontNumber()
int
getFontScalingTechnology()
java.util.List<PCLFontSegment>
getFontSegments(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs)
Segmented Font Dataint
getFontType()
private byte[]
getGlobalTrueTypeData(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs)
int
getHeaderFormat()
int
getHeight()
int
getHeightExtended()
int
getLastCode()
int
getMasterUnderlinePosition()
int
getMasterUnderlineThickness()
int
getOrientation()
int
getPitch()
int
getPitchExtended()
int
getPlacement()
int
getQuality()
int
getScaleFactor()
int
getSerifStyle()
int
getSpacing()
int
getStrokeWeight()
int
getStyleLSB()
int
getStyleMSB()
int
getSymbolSet()
int
getTextHeight()
int
getTextWidth()
private PCLTTFTableFactory
getTTFTableFactory()
int
getTypefaceLSB()
int
getTypefaceMSB()
int
getUnderlinePosition()
int
getUnderlineThickness()
int
getVariety()
int
getWidthType()
int
getXHeight()
protected void
loadFont()
private PCLTTFTable
readFontTable(OFTableName tableName)
protected void
readFontTables()
java.util.Map<java.lang.Integer,java.lang.Integer>
scanMtxCharacters()
private byte[]
updateHHEA(byte[] tableData, int hmtxSize)
private java.io.ByteArrayOutputStream
updateOffsets(java.io.ByteArrayOutputStream baos, java.util.Map<java.lang.Integer,byte[]> offsets)
private void
writeGDIR(java.io.ByteArrayOutputStream baos)
private void
writeSubsetHMTX(java.io.ByteArrayOutputStream baos, OFTableName table, java.util.List<PCLTTFFontReader.TableOffset> tableOffsets, byte[] hmtxTable)
private void
writeTrueTypeTable(java.io.ByteArrayOutputStream baos, OFTableName table, java.util.List<PCLTTFFontReader.TableOffset> tableOffsets)
private void
writeUShort(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:PCLFontReader
Header Data- Specified by:
getDescriptorSize
in classPCLFontReader
-
getHeaderFormat
public int getHeaderFormat()
- Specified by:
getHeaderFormat
in classPCLFontReader
-
getFontType
public int getFontType()
- Specified by:
getFontType
in classPCLFontReader
-
getStyleMSB
public int getStyleMSB()
- Specified by:
getStyleMSB
in classPCLFontReader
-
getBaselinePosition
public int getBaselinePosition()
- Specified by:
getBaselinePosition
in classPCLFontReader
-
getCellWidth
public int getCellWidth()
- Specified by:
getCellWidth
in classPCLFontReader
-
getCellHeight
public int getCellHeight()
- Specified by:
getCellHeight
in classPCLFontReader
-
getOrientation
public int getOrientation()
- Specified by:
getOrientation
in classPCLFontReader
-
getSpacing
public int getSpacing()
- Specified by:
getSpacing
in classPCLFontReader
-
getSymbolSet
public int getSymbolSet()
- Specified by:
getSymbolSet
in classPCLFontReader
-
getPitch
public int getPitch()
- Specified by:
getPitch
in classPCLFontReader
-
getHeight
public int getHeight()
- Specified by:
getHeight
in classPCLFontReader
-
getXHeight
public int getXHeight()
- Specified by:
getXHeight
in classPCLFontReader
-
getWidthType
public int getWidthType()
- Specified by:
getWidthType
in classPCLFontReader
-
convertTTFWidthClass
private int convertTTFWidthClass(int widthClass)
-
getStyleLSB
public int getStyleLSB()
- Specified by:
getStyleLSB
in classPCLFontReader
-
getStrokeWeight
public int getStrokeWeight()
- Specified by:
getStrokeWeight
in classPCLFontReader
-
convertTTFWeightClass
private int convertTTFWeightClass(int weightClass)
-
getTypefaceLSB
public int getTypefaceLSB()
- Specified by:
getTypefaceLSB
in classPCLFontReader
-
getTypefaceMSB
public int getTypefaceMSB()
- Specified by:
getTypefaceMSB
in classPCLFontReader
-
getSerifStyle
public int getSerifStyle()
- Specified by:
getSerifStyle
in classPCLFontReader
-
convertFromTTFSerifStyle
private int convertFromTTFSerifStyle()
-
getQuality
public int getQuality()
- Specified by:
getQuality
in classPCLFontReader
-
getPlacement
public int getPlacement()
- Specified by:
getPlacement
in classPCLFontReader
-
getUnderlinePosition
public int getUnderlinePosition()
- Specified by:
getUnderlinePosition
in classPCLFontReader
-
getUnderlineThickness
public int getUnderlineThickness()
- Specified by:
getUnderlineThickness
in classPCLFontReader
-
getTextHeight
public int getTextHeight()
- Specified by:
getTextHeight
in classPCLFontReader
-
getTextWidth
public int getTextWidth()
- Specified by:
getTextWidth
in classPCLFontReader
-
getFirstCode
public int getFirstCode()
- Specified by:
getFirstCode
in classPCLFontReader
-
getLastCode
public int getLastCode()
- Specified by:
getLastCode
in classPCLFontReader
-
getPitchExtended
public int getPitchExtended()
- Specified by:
getPitchExtended
in classPCLFontReader
-
getHeightExtended
public int getHeightExtended()
- Specified by:
getHeightExtended
in classPCLFontReader
-
getCapHeight
public int getCapHeight()
- Specified by:
getCapHeight
in classPCLFontReader
-
getFontNumber
public int getFontNumber()
- Specified by:
getFontNumber
in classPCLFontReader
-
getFontName
public java.lang.String getFontName()
- Specified by:
getFontName
in classPCLFontReader
-
getScaleFactor
public int getScaleFactor() throws java.io.IOException
- Specified by:
getScaleFactor
in classPCLFontReader
- Throws:
java.io.IOException
-
getMasterUnderlinePosition
public int getMasterUnderlinePosition() throws java.io.IOException
- Specified by:
getMasterUnderlinePosition
in classPCLFontReader
- Throws:
java.io.IOException
-
getMasterUnderlineThickness
public int getMasterUnderlineThickness() throws java.io.IOException
- Specified by:
getMasterUnderlineThickness
in classPCLFontReader
- Throws:
java.io.IOException
-
getFontScalingTechnology
public int getFontScalingTechnology()
- Specified by:
getFontScalingTechnology
in classPCLFontReader
-
getVariety
public int getVariety()
- Specified by:
getVariety
in 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:PCLFontReader
Segmented Font Data- Specified by:
getFontSegments
in 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.IOException
Description copied from class:PCLFontReader
Character Definitions- Specified by:
getCharacterOffsets
in classPCLFontReader
- Throws:
java.io.IOException
-
getFontFile
public OpenFont getFontFile()
- Specified by:
getFontFile
in classPCLFontReader
-
getFontFileReader
public FontFileReader getFontFileReader()
- Specified by:
getFontFileReader
in 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:
scanMtxCharacters
in classPCLFontReader
- Throws:
java.io.IOException
-
-