java.lang.Object
org.xhtmlrenderer.swing.Java2DTextRenderer
- All Implemented Interfaces:
TextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
public class Java2DTextRenderer
extends Object
implements TextRenderer<Java2DOutputDevice,Java2DFontContext,AWTFSFont>
Renders to a Graphics2D instance.
- Author:
- Joshua Marinacci, Torbjoern Gannholm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawGlyphVector(Java2DOutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y) voiddrawString(Java2DOutputDevice outputDevice, String string, float x, float y) voiddrawString(Java2DOutputDevice outputDevice, String string, float x, float y, JustificationInfo info) floatgetFSFontMetrics(Java2DFontContext fc, AWTFSFont font, String string) getGlyphBounds(Java2DOutputDevice outputDevice, AWTFSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) float[]getGlyphPositions(Java2DOutputDevice outputDevice, AWTFSFont font, String text) float[]getGlyphPositions(Java2DOutputDevice outputDevice, AWTFSFont font, FSGlyphVector fsGlyphVector) getGlyphVector(Java2DOutputDevice outputDevice, AWTFSFont font, String text) If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.intgetWidth(Java2DFontContext fc, AWTFSFont font, String string) voidsetFontScale(float scale) voidsetRenderingHints(Object renderingHints) If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.voidsetSmoothingThreshold(float fontsize) Set the smoothing threshold.voidsetup(Java2DFontContext fontContext)
-
Constructor Details
-
Java2DTextRenderer
public Java2DTextRenderer()
-
-
Method Details
-
drawString
- Specified by:
drawStringin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
drawString
public void drawString(Java2DOutputDevice outputDevice, String string, float x, float y, JustificationInfo info) - Specified by:
drawStringin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
drawGlyphVector
public void drawGlyphVector(Java2DOutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y) - Specified by:
drawGlyphVectorin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
setup
- Specified by:
setupin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
setFontScale
public void setFontScale(float scale) - Specified by:
setFontScalein interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
setSmoothingThreshold
public void setSmoothingThreshold(float fontsize) Description copied from interface:TextRendererSet the smoothing threshold. This is a font size above which all text will be anti-aliased. Text below this size will not be anti-aliased. Set to -1 for no antialiasing. Set to 0 for all antialiasing. Else, set to the threshold font size. does not take font scaling into account.- Specified by:
setSmoothingThresholdin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
getFSFontMetrics
@CheckReturnValue public FSFontMetrics getFSFontMetrics(Java2DFontContext fc, AWTFSFont font, String string) - Specified by:
getFSFontMetricsin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
getWidth
- Specified by:
getWidthin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
getFontScale
public float getFontScale()- Specified by:
getFontScalein interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
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
-
setRenderingHints
If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D. Defaults toRenderingHints.VALUE_TEXT_ANTIALIAS_ON.- Parameters:
renderingHints- rendering hint for AA smoothing in Java2D
-
getGlyphPositions
-
getGlyphBounds
public Rectangle getGlyphBounds(Java2DOutputDevice outputDevice, AWTFSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) - Specified by:
getGlyphBoundsin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
getGlyphPositions
public float[] getGlyphPositions(Java2DOutputDevice outputDevice, AWTFSFont font, FSGlyphVector fsGlyphVector) - Specified by:
getGlyphPositionsin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-
getGlyphVector
- Specified by:
getGlyphVectorin interfaceTextRenderer<Java2DOutputDevice,Java2DFontContext, AWTFSFont>
-