一个可以以像素为单位渲染 Font 字符的 java JComponent

发布于 2024-11-09 10:15:36 字数 400 浏览 5 评论 0原文

我想知道这样的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毅然前行 2024-11-16 10:15:36

您可以获取字形的位图,如此处所述,并按照建议进行编辑 这里

You can get a glyph's bitmap, as mentioned here, and edit it, as suggested here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文