e653. 写入段落文本
文本 写入 段落
2023-09-14 09:12:00 时间
In order to change the font of the text, you need to supply an attributed string to the LineBreakMeasurer
. See e655 混合风格的文本 for an example.
public void drawParagraph(Graphics2D g, String paragraph, float width) { LineBreakMeasurer linebreaker = new LineBreakMeasurer( new AttributedString(paragraph).getIterator(), g.getFontRenderContext()); float y = 0.0f; while (linebreaker.getPosition() < paragraph.length()) { TextLayout tl = linebreaker.nextLayout(width); y += tl.getAscent(); tl.draw(g, 0, y); y += tl.getDescent() + tl.getLeading(); } }
Related Examples |
相关文章
- php案例 去掉文本所有的空格
- python读取、写入txt文本内容
- tensorflow(四十八): 使用tensorboard可视化训练出的文本embedding
- 【文本检测与识别白皮书-3.2】第一节:基于分割的场景文本识别方法
- 搜狐文本匹配算法大赛方案总结
- scrapy爬取数据并保存到文本
- 跟着Nature学作图:R语言pheatmap包做热图并添加文本标注
- dotnet 将任意时区的 DateTimeOffset 转换为中国时区时间文本
- 使用 text-overflow:ellipsis 实现 CSS 文本溢出省略号
- java 检测文本、文件编码详解编程语言
- 编辑Linux文本网页编辑技巧介绍(linux文本网页)
- search使用MongoDB实现文本搜索功能(mongodbtext)
- 利用AWK在Linux中进行文本分割: 25字技巧(awklinux分割)
- 掌握Linux Sed,轻松处理文本信息(linuxsed的使用)
- javascript实现文本域写入字符时限定字数