Drawing text with outline in java

大城市里の小女人 提交于 2019-11-28 08:48:30
trashgod

You may be able to use the method createStrokedShape() on the glyph's Shape returned by getOutline(). See also CompositeStroke, demonstrated here.

Try to use

layoutGlyphVector(FontRenderContext frc, char[] text, int start, int limit, int flags) 

instead of the createGlyphVector

One trick is to draw the text several times in the outline color, varying the position by the outline width in +/- x and +/- y directions, then draw in the foreground color at the nominal position. It isn't perfect, but it tends to look pretty good provided the outline isn't too thick with respect to the stroke width of the letters.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!