Linux 中是否存在用户级可访问的字体表?

发布于 2024-10-10 11:29:12 字数 623 浏览 3 评论 0原文

因为有这个: http://en.wikipedia.org/wiki/Code_page_437 对于 MSDOS, Linux系统有类似的东西吗?是否可以通过用户层程序访问该字体数据?实际上,我只需要访问定义字体的实际位模式,然后我自己进行渲染。我相当确定这样的东西存在,但我无法找到它到底是什么以及如何访问它。毕竟,例如文本模式控制台字体必须驻留在某个地方,我真的希望它可以“原始”访问某种方式为用户态程序。

在我忘记之前,我正在用 C 语言编写程序,并且只能访问“标准”linux/posix 开发头文件。我自己能想到的唯一办法就是使用 /usr/share/fonts 中的字体,但是必须编写自己的实现来从那里提取数据听起来并不是一个真正的选择;我真的很想用尽可能少的字节来实现这一点,所以我觉得我只能找到一种标准的方法来做到这一点。

对于我来说,用程序存储我自己的 8x8 ASCII 兼容字体也不太可行(它需要一些 1024 字节(128 个字符 * 8x8 位)来存储字体,这对于严格的大小限制来说绝对是不可接受的(一些 < ; 1024 字节用于代码+数据),因此能够使用系统本身存储的字体数据将大大简化我的任务。

Since there is this: http://en.wikipedia.org/wiki/Code_page_437 For MSDOS, is there something similar for Linux systems? Is it possible to access that font data via userland program? I would actually just need an access to the actual bit patterns which define the font, and I would do the rendering myself. I'm fairly sure that something like this exists, but I haven't been able to find what exactly is it and how to access it. After all, e.g. text mode console font has to reside somewhere, and I really do hope it is "rawly" accessible somehow for a userland program.

Before I forget, I'm programming my program in C, and have access only to the "standard" linux/posix development headers. The only thing I could came up with myself is to use the fonts in /usr/share/fonts, but having to write my own implementations to extract the data from there doesn't sound really an option; I would really want to achieve this with the least amount of bytes possible, so I feel I'm left with finding a standard way of doing this.

It's not really feasible for me to store my own 8x8 ASCII-compatible font with the program either(it takes some 1024 bytes(128 chars * 8x8 bits) just to store the font, which is definitely unacceptable for the strict size limits(some < 1024 bytes for code+data) which I am working with), so being able to use the font data stored at the system itself would greatly simplify my task.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

徒留西风 2024-10-17 11:29:13

我查看了 consolechars 源代码,看起来有一个完整的库用于此类内容。在 Ubuntu 上,它名为 libconsole,头文件(如 lct/font.h)位于 console-tools-dev 包中。有一些功能可以查找和加载字体,这似乎正是您所需要的。 consolechars 源是如何使用它们的一个很好的例子。

I had a look at consolechars sources and it looks like there is a whole library for this kind of stuff. On Ubuntu it's named libconsole and header files (like lct/font.h) are in the console-tools-dev package. There are functions to find and load fonts which seems to be exactly what you need. And consolechars source is a nice example of how to use them.

最美的太阳 2024-10-17 11:29:13

您应该使用 freetype ,它通常安装在所有 Linux 中。

You should use freetype , its commonly installed in all the Linuxes.

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