Package org.apache.fop.render.pcl.fonts
Class PCLSoftFontManager
- java.lang.Object
-
- org.apache.fop.render.pcl.fonts.PCLSoftFontManager
-
public class PCLSoftFontManager extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PCLSoftFontManager.PCLTextSegment
-
Field Summary
Fields Modifier and Type Field Description private PCLFontReader
fontReader
private java.util.Map<Typeface,PCLFontReader>
fontReaderMap
private java.util.List<PCLSoftFont>
fonts
private static int
SOFT_FONT_SIZE
-
Constructor Summary
Constructors Constructor Description PCLSoftFontManager(java.util.Map<Typeface,PCLFontReader> fontReaderMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
assignFontID(int fontID)
private int
countNonMatches(PCLSoftFont font, java.lang.String text)
private byte[]
getFontHeaderCommand(int headerSize)
PCLSoftFont
getSoftFont(Typeface font, java.lang.String text)
Finds a soft font associated with the given typeface.private PCLSoftFont
getSoftFont(Typeface font, java.lang.String text, java.util.List<java.util.Map<java.lang.Character,java.lang.Integer>> mappedGlyphs, PCLSoftFont last)
PCLSoftFont
getSoftFontFromID(int index)
int
getSoftFontID(Typeface tf)
java.util.List<PCLSoftFontManager.PCLTextSegment>
getTextSegments(java.lang.String text, Typeface font)
private boolean
isComposite(CustomFont customFont, int unicode)
java.io.ByteArrayOutputStream
makeSoftFont(Typeface font, java.lang.String text)
private java.util.List<java.util.Map<java.lang.Character,java.lang.Integer>>
mapFontGlyphs(Typeface tf)
private java.util.List<java.util.Map<java.lang.Character,java.lang.Integer>>
mapGlyphs(java.util.Map<java.lang.Integer,java.lang.Integer> usedGlyphs, CustomFont font)
private void
writeFontHeader(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs, java.io.OutputStream os)
private void
writeFontID(int fontID, java.io.OutputStream os)
private void
writeFontSegment(java.io.ByteArrayOutputStream header, PCLFontSegment segment)
private void
writeSegmentedFontData(java.io.ByteArrayOutputStream header, java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs)
-
-
-
Field Detail
-
fontReaderMap
private java.util.Map<Typeface,PCLFontReader> fontReaderMap
-
fontReader
private PCLFontReader fontReader
-
fonts
private java.util.List<PCLSoftFont> fonts
-
SOFT_FONT_SIZE
private static final int SOFT_FONT_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PCLSoftFontManager
public PCLSoftFontManager(java.util.Map<Typeface,PCLFontReader> fontReaderMap)
-
-
Method Detail
-
makeSoftFont
public java.io.ByteArrayOutputStream makeSoftFont(Typeface font, java.lang.String text) throws java.io.IOException
- Throws:
java.io.IOException
-
getSoftFont
private PCLSoftFont getSoftFont(Typeface font, java.lang.String text, java.util.List<java.util.Map<java.lang.Character,java.lang.Integer>> mappedGlyphs, PCLSoftFont last)
-
mapFontGlyphs
private java.util.List<java.util.Map<java.lang.Character,java.lang.Integer>> mapFontGlyphs(Typeface tf) throws java.io.IOException
- Throws:
java.io.IOException
-
mapGlyphs
private java.util.List<java.util.Map<java.lang.Character,java.lang.Integer>> mapGlyphs(java.util.Map<java.lang.Integer,java.lang.Integer> usedGlyphs, CustomFont font) throws java.io.IOException
- Throws:
java.io.IOException
-
isComposite
private boolean isComposite(CustomFont customFont, int unicode) throws java.io.IOException
- Throws:
java.io.IOException
-
writeFontID
private void writeFontID(int fontID, java.io.OutputStream os) throws java.io.IOException
- Throws:
java.io.IOException
-
assignFontID
public byte[] assignFontID(int fontID) throws java.io.IOException
- Throws:
java.io.IOException
-
writeFontHeader
private void writeFontHeader(java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs, java.io.OutputStream os) throws java.io.IOException
- Throws:
java.io.IOException
-
writeSegmentedFontData
private void writeSegmentedFontData(java.io.ByteArrayOutputStream header, java.util.Map<java.lang.Character,java.lang.Integer> mappedGlyphs) throws java.io.IOException
- Throws:
java.io.IOException
-
getFontHeaderCommand
private byte[] getFontHeaderCommand(int headerSize) throws java.io.IOException
- Throws:
java.io.IOException
-
writeFontSegment
private void writeFontSegment(java.io.ByteArrayOutputStream header, PCLFontSegment segment) throws java.io.IOException
- Throws:
java.io.IOException
-
getSoftFont
public PCLSoftFont getSoftFont(Typeface font, java.lang.String text)
Finds a soft font associated with the given typeface. If more than one instance of the font exists (as each font is bound and restricted to 255 characters) it will find the last font with available capacity.- Parameters:
font
- The typeface associated with the soft font- Returns:
- Returns the PCLSoftFont with available capacity
-
getSoftFontFromID
public PCLSoftFont getSoftFontFromID(int index)
-
countNonMatches
private int countNonMatches(PCLSoftFont font, java.lang.String text)
-
getSoftFontID
public int getSoftFontID(Typeface tf) throws java.io.IOException
- Throws:
java.io.IOException
-
getTextSegments
public java.util.List<PCLSoftFontManager.PCLTextSegment> getTextSegments(java.lang.String text, Typeface font)
-
-