Package com.openhtmltopdf.java2d
Class Java2DTextRenderer
- java.lang.Object
-
- com.openhtmltopdf.java2d.Java2DTextRenderer
-
- All Implemented Interfaces:
TextRenderer
public class Java2DTextRenderer extends Object implements TextRenderer
Renders to a Graphics2D instance.- Author:
- Joshua Marinacci, Torbjoern Gannholm
-
-
Field Summary
Fields Modifier and Type Field Description protected static intANTI_ALIAS_FONT_SIZE_MINprotected ObjectantiAliasRenderingHintprotected ObjectfractionalFontMetricsHint
-
Constructor Summary
Constructors Constructor Description Java2DTextRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrawString(OutputDevice outputDevice, String string, float x, float y)voiddrawString(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info)Draws a justified string.protected intgetAntiAliasMinFontSize()FSFontMetricsgetFSFontMetrics(FontContext fc, FSFont font, String string)float[]getGlyphPositions(OutputDevice outputDevice, FSFont font, String text)This method gets glyph positions for purposes of selecting text.ObjectgetRenderingHints()If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.intgetWidth(FontContext fc, FSFont font, String string)voidsetup(FontContext context)voidsetup(FontContext fontContext, BidiReorderer bidiReorderer)
-
-
-
Field Detail
-
ANTI_ALIAS_FONT_SIZE_MIN
protected static final int ANTI_ALIAS_FONT_SIZE_MIN
- See Also:
- Constant Field Values
-
antiAliasRenderingHint
protected final Object antiAliasRenderingHint
-
fractionalFontMetricsHint
protected final Object fractionalFontMetricsHint
-
-
Method Detail
-
getAntiAliasMinFontSize
protected int getAntiAliasMinFontSize()
-
drawString
public void drawString(OutputDevice outputDevice, String string, float x, float y)
- Specified by:
drawStringin interfaceTextRenderer
-
drawString
public void drawString(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info)
Draws a justified string.- Specified by:
drawStringin interfaceTextRenderer
-
setup
public void setup(FontContext fontContext, BidiReorderer bidiReorderer)
-
getFSFontMetrics
public FSFontMetrics getFSFontMetrics(FontContext fc, FSFont font, String string)
- Specified by:
getFSFontMetricsin interfaceTextRenderer
-
getWidth
public int getWidth(FontContext fc, FSFont font, String string)
- Specified by:
getWidthin interfaceTextRenderer
-
getRenderingHints
public Object getRenderingHints()
If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D. Defaults toRenderingHints.VALUE_TEXT_ANTIALIAS_ON.- Returns:
- Current AA rendering hint
-
getGlyphPositions
public float[] getGlyphPositions(OutputDevice outputDevice, FSFont font, String text)
This method gets glyph positions for purposes of selecting text. WE are not too worried about selecting text at this point so we just use the first font available.
-
setup
public void setup(FontContext context)
- Specified by:
setupin interfaceTextRenderer
-
-