一个可以以像素为单位渲染 Font 字符的 java JComponent
我想知道这样的java组件是否存在,请允许我详细说明。
该组件应该是一个类似网格的组件,源自 JComponent。主面是一个网格,它将用于渲染字体字符。网格根据输入字体字符的大小进行划分。例如,如果输入是“Arial,PLAIN,16”的“A”,则网格将有16X16个单元格,每个单元格代表字符的一个像素,仅比真实像素大得多,并且字符被渲染在里面网格。当然,16 像素的字符太小,无法清晰地看到其实际大小,因此网格面板实际上将其放大。另外,用户可以动态更改字体大小,例如从 16 到 32,网格面板不会更改其大小,仅将单元格重新划分为 32X32,并重新绘制字符,模拟 32X32 像素字符。
我猜绘画软件有类似的东西,我只是想知道 Java 中是否有这样的组件,开源的或商业的,否则我必须费很大的力气自己创建一个:-)。
谢谢, 约翰
I am wondering if such a java component even exists, please allow me to elaborate.
The component is supposed to be a grid-like component, derived from JComponent. The main face is a grid, and it will be used to render a font character. The grid is divided based on the size of the input font character. For instance, if the input is a "A" of "Arial, PLAIN, 16", the grid will have 16X16 cells, each cell represents a pixel of the character, only much larger than the real pixel, and the character is rendered inside the grid. Of cause a char of 16 pixel is too small to be seen clearly in its real size, so the grid panel actually magnifies it. Also, user can change the font size on the fly, say from 16 to 32, the grid panel doesn't change its size, only re-divide the cells into 32X32, and redraw the character, simulating a 32X32 pixel char.
I guess painting software has something like that, I just wonder if there is such a component out there in Java, open source or commercial, otherwise I have to take great pain to create one myself :-).
Thanks,
John
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以获取字形的位图,如此处所述,并按照建议进行编辑 这里。
You can get a glyph's bitmap, as mentioned here, and edit it, as suggested here.