使用 Ncurses 打印双倍大小的字符

发布于 2024-09-14 06:17:23 字数 230 浏览 9 评论 0原文

许多终端模拟器(xterm、Konsole)支持双倍大小字符。 Ncurses 不支持这一点,据我所知,ncurses 不会打印转义字符(\033 将不转义并以明文形式打印)。

是否有可能在 ncurses 应用程序中打印双倍大小的字符?

Many terminal emulators (xterm, Konsole) support double-size characters. Ncurses does not support this and as far as I know, ncurses will not print escape characters (\033 will be unescaped and printed in clear text).

Is it possible at all to print double-size characters in a ncurses application?

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

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

发布评论

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

评论(1

走走停停 2024-09-21 06:17:23

您引用的“双倍大小”字符功能由以下 ANSI 序列设置(找到 此处):

ESC # 3   DEC double-height line, top half (DECDHL), VT100.
ESC # 4   DEC double-height line, bottom half (DECDHL), VT100.
ESC # 5   DEC single-width line (DECSWL), VT100.
ESC # 6   DEC double-width line (DECDWL), VT100.

\e#3 属性使终端切换字符集为仅包含每个字符的上半部分。同样,\e#4 切换到包含下半部分的字符集。通过将它们一起使用,

echo -e "\e#3Foo\n\e#4Foo"

终端可以在两个单独的行上显示“双倍高度”文本。

据我所知,你是对的 - ncurses 还没有“实现”它们 - 也许是因为它们依赖于 DECTerminals 最初独有的专用字体集。

言归正传,这似乎不可能,因为 ncurses 没有此功能的属性,尽管我承认找不到任何直接说明它不是的参考资料可能的。也许具有疯狂 terminfo 技能的人可以解释为什么是(或不是)这种情况。

The "double-size" character capability you refer to is set by the following ANSI sequences (found here):

ESC # 3   DEC double-height line, top half (DECDHL), VT100.
ESC # 4   DEC double-height line, bottom half (DECDHL), VT100.
ESC # 5   DEC single-width line (DECSWL), VT100.
ESC # 6   DEC double-width line (DECDWL), VT100.

The \e#3 attribute makes the terminal switch character sets to one which only contains the top-half of each character. Similarly, \e#4 switches to a character set containing the bottom-half. By using these together,

echo -e "\e#3Foo\n\e#4Foo"

the terminal can display a "double-height" text on two separate lines.

As far as I can tell you're right - ncurses hasn't "implemented" them - perhaps because they rely on a specialized fontset originally unique to DECTerminals.

Getting to the point, it doesn't seem possible since ncurses has no attribute for this feature, although I admittedly can't find any reference directly stating that it isn't possible. Perhaps someone with crazy terminfo skills can explain why this is (or isn't) the case.

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