Package org.apache.fop.render.java2d
Class Java2DUtil
java.lang.Object
org.apache.fop.render.java2d.Java2DUtil
Rendering-related utilities for Java2D.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FontInfobuildDefaultJava2DBasedFontInfo(FontInfo fontInfo, FOUserAgent userAgent) Builds a defaultFontInfoobject for use with output formats using the Java2D font setup.private static GlyphVectorcreateGlyphVector(String text, Graphics2D g2d) Creates aGlyphVectorusing characters.static GlyphVectorcreateGlyphVector(String text, Graphics2D g2d, Font font, FontInfo fontInfo) Creates an instance ofGlyphVectorthat correctly handle surrogate pairs and advanced font features such as GSUB/GPOS/GDEF.private static GlyphVectorcreateGlyphVectorMultiByteFont(String text, Graphics2D g2d, MultiByteFont multiByteFont) Creates aGlyphVectorusing glyph indexes instead of characters.private static MultiByteFontgetMultiByteFont(String fontName, FontInfo fontInfo) Returns an instance ofMultiByteFontfor the given font name.
-
Constructor Details
-
Java2DUtil
private Java2DUtil()
-
-
Method Details
-
buildDefaultJava2DBasedFontInfo
Builds a defaultFontInfoobject for use with output formats using the Java2D font setup.- Parameters:
fontInfo- the font info object to populateuserAgent- the user agent- Returns:
- the populated font information object
-
createGlyphVector
public static GlyphVector createGlyphVector(String text, Graphics2D g2d, Font font, FontInfo fontInfo) Creates an instance ofGlyphVectorthat correctly handle surrogate pairs and advanced font features such as GSUB/GPOS/GDEF.- Parameters:
text- Text to renderg2d- the target Graphics2D instancefont- the font instancefontInfo- the font information- Returns:
- an instance of
GlyphVector
-
createGlyphVector
Creates aGlyphVectorusing characters. Filters out non-bmp characters. -
createGlyphVectorMultiByteFont
private static GlyphVector createGlyphVectorMultiByteFont(String text, Graphics2D g2d, MultiByteFont multiByteFont) Creates aGlyphVectorusing glyph indexes instead of characters. To correctly support the advanced font features we have to build the GlyphVector passing the glyph indexes instead of the characters. This because some of the chars in text might have been replaced by an internal font representation during GlyphMapping.processWordMapping. Eg 'fi' replaced with the corresponding character in the font ligatures table (GSUB). -
getMultiByteFont
Returns an instance ofMultiByteFontfor the given font name. This method will try to unwrap containers such asCustomFontMetricsMapperandLazyFont- Parameters:
fontName- font keyfontInfo- font information- Returns:
- An instance of
MultiByteFontor null if it
-