Package org.xhtmlrenderer.swing
Class Java2DTextRenderer
java.lang.Object
org.xhtmlrenderer.swing.Java2DTextRenderer
- All Implemented Interfaces:
TextRenderer
Renders to a Graphics2D instance.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
adjustGlyphPositions
(String string, JustificationInfo info, GlyphVector vector) void
drawGlyphVector
(OutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y) void
drawString
(OutputDevice outputDevice, String string, float x, float y) void
drawString
(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info) private static Map
<RenderingHints.Key, Object> float
getFSFontMetrics
(FontContext fc, FSFont font, String string) getGlyphBounds
(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) float[]
getGlyphPositions
(OutputDevice outputDevice, FSFont font, String text) float[]
getGlyphPositions
(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector) getGlyphVector
(OutputDevice outputDevice, FSFont font, String text) If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.int
getWidth
(FontContext fc, FSFont font, String string) void
setFontScale
(float scale) void
setRenderingHints
(Object renderingHints) If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.void
setSmoothingThreshold
(float fontsize) Set the smoothing threshold.void
setup
(FontContext fontContext)
-
Field Details
-
scale
private float scale -
threshold
private float threshold -
antiAliasRenderingHint
-
fractionalFontMetricsHint
-
-
Constructor Details
-
Java2DTextRenderer
public Java2DTextRenderer()
-
-
Method Details
-
getFontDesktopHints
-
drawString
- Specified by:
drawString
in interfaceTextRenderer
-
drawString
public void drawString(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info) - Specified by:
drawString
in interfaceTextRenderer
-
adjustGlyphPositions
-
drawGlyphVector
public void drawGlyphVector(OutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y) - Specified by:
drawGlyphVector
in interfaceTextRenderer
-
setup
- Specified by:
setup
in interfaceTextRenderer
-
setFontScale
public void setFontScale(float scale) - Specified by:
setFontScale
in interfaceTextRenderer
-
setSmoothingThreshold
public void setSmoothingThreshold(float fontsize) Description copied from interface:TextRenderer
Set 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:
setSmoothingThreshold
in interfaceTextRenderer
-
getFSFontMetrics
- Specified by:
getFSFontMetrics
in interfaceTextRenderer
-
getWidth
- Specified by:
getWidth
in interfaceTextRenderer
-
getFontScale
public float getFontScale()- Specified by:
getFontScale
in interfaceTextRenderer
-
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(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) - Specified by:
getGlyphBounds
in interfaceTextRenderer
-
getGlyphPositions
public float[] getGlyphPositions(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector) - Specified by:
getGlyphPositions
in interfaceTextRenderer
-
getGlyphVector
- Specified by:
getGlyphVector
in interfaceTextRenderer
-