Package org.apache.fop.render.ps
Class PSFontUtils
java.lang.Object
org.apache.xmlgraphics.ps.PSFontUtils
org.apache.fop.render.ps.PSFontUtils
public class PSFontUtils
extends org.apache.xmlgraphics.ps.PSFontUtils
Utility code for font handling in PostScript.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final org.apache.commons.logging.Log
logging instanceFields inherited from class org.apache.xmlgraphics.ps.PSFontUtils
ADOBECYRILLIC_ENCODING_RESOURCE, WINANSI_ENCODING_RESOURCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addFallbackFonts
(FontInfo fontInfo, org.apache.xmlgraphics.java2d.GeneralGraphics2DImagePainter painter) static org.apache.xmlgraphics.ps.PSResource
defineDerivedFont
(org.apache.xmlgraphics.ps.PSGenerator gen, String baseFontName, String fontName, String encoding) Derives a new font based on an existing font with a given encoding.static org.apache.xmlgraphics.ps.PSResource
defineEncoding
(org.apache.xmlgraphics.ps.PSGenerator gen, SingleByteEncoding encoding) Defines the single-byte encoding for use in PostScript files.static Map
determineSuppliedFonts
(org.apache.xmlgraphics.ps.dsc.ResourceTracker resTracker, FontInfo fontInfo, Map<String, Typeface> fonts) Determines the set of fonts that will be supplied with the PS file and registers them with the resource tracker.static Map
writeFontDict
(org.apache.xmlgraphics.ps.PSGenerator gen, FontInfo fontInfo) Generates the PostScript code for the font dictionary.static Map
writeFontDict
(org.apache.xmlgraphics.ps.PSGenerator gen, FontInfo fontInfo, Map<String, Typeface> fonts, PSEventProducer eventProducer) Generates the PostScript code for the font dictionary.static Map
writeFontDict
(org.apache.xmlgraphics.ps.PSGenerator gen, FontInfo fontInfo, PSEventProducer eventProducer) Generates the PostScript code for the font dictionary.Methods inherited from class org.apache.xmlgraphics.ps.PSFontUtils
defineAdobeCyrillicEncoding, defineWinAnsiEncoding, embedType1Font, redefineFontEncoding
-
Field Details
-
log
protected static final org.apache.commons.logging.Log loglogging instance
-
-
Constructor Details
-
PSFontUtils
public PSFontUtils()
-
-
Method Details
-
writeFontDict
public static Map writeFontDict(org.apache.xmlgraphics.ps.PSGenerator gen, FontInfo fontInfo) throws IOException Generates the PostScript code for the font dictionary. This method should only be used if no "resource optimization" is performed, i.e. when the fonts are not embedded in a second pass.- Parameters:
gen
- PostScript generator to use for outputfontInfo
- available fonts- Returns:
- a Map of PSResource instances representing all defined fonts (key: font key)
- Throws:
IOException
- in case of an I/O problem
-
writeFontDict
public static Map writeFontDict(org.apache.xmlgraphics.ps.PSGenerator gen, FontInfo fontInfo, PSEventProducer eventProducer) throws IOException Generates the PostScript code for the font dictionary. This method should only be used if no "resource optimization" is performed, i.e. when the fonts are not embedded in a second pass.- Parameters:
gen
- PostScript generator to use for outputfontInfo
- available fontseventProducer
- to report events- Returns:
- a Map of PSResource instances representing all defined fonts (key: font key)
- Throws:
IOException
- in case of an I/O problem
-
writeFontDict
public static Map writeFontDict(org.apache.xmlgraphics.ps.PSGenerator gen, FontInfo fontInfo, Map<String, Typeface> fonts, PSEventProducer eventProducer) throws IOExceptionGenerates the PostScript code for the font dictionary. This method assumes all used fonts and characters are known, i.e. when PostScript is generated with resource optimization turned on.- Parameters:
gen
- PostScript generator to use for outputfontInfo
- available fontsfonts
- the set of fonts to work witheventProducer
- the event producer- Returns:
- a Map of PSResource instances representing all defined fonts (key: font key)
- Throws:
IOException
- in case of an I/O problem
-
determineSuppliedFonts
public static Map determineSuppliedFonts(org.apache.xmlgraphics.ps.dsc.ResourceTracker resTracker, FontInfo fontInfo, Map<String, Typeface> fonts) Determines the set of fonts that will be supplied with the PS file and registers them with the resource tracker. All the fonts that are being processed are returned as a Map.- Parameters:
resTracker
- the resource trackerfontInfo
- available fontsfonts
- the set of fonts to work with- Returns:
- a Map of PSResource instances representing all defined fonts (key: font key)
-
defineEncoding
public static org.apache.xmlgraphics.ps.PSResource defineEncoding(org.apache.xmlgraphics.ps.PSGenerator gen, SingleByteEncoding encoding) throws IOException Defines the single-byte encoding for use in PostScript files.- Parameters:
gen
- the PostScript generatorencoding
- the single-byte encoding- Returns:
- the PSResource instance that represents the encoding
- Throws:
IOException
- In case of an I/O problem
-
defineDerivedFont
public static org.apache.xmlgraphics.ps.PSResource defineDerivedFont(org.apache.xmlgraphics.ps.PSGenerator gen, String baseFontName, String fontName, String encoding) throws IOException Derives a new font based on an existing font with a given encoding. The encoding must have been registered before.- Parameters:
gen
- the PostScript generatorbaseFontName
- the font name of the font to derive fromfontName
- the font name of the new font to be defineencoding
- the new encoding (must be predefined in the PS file)- Returns:
- the PSResource representing the derived font
- Throws:
IOException
- In case of an I/O problem
-
addFallbackFonts
public static void addFallbackFonts(FontInfo fontInfo, org.apache.xmlgraphics.java2d.GeneralGraphics2DImagePainter painter) throws IOException - Throws:
IOException
-