1 Star 0 Fork 0

tony1981/qemacs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
xterm-146-dw-patch 2.29 KB
一键复制 编辑 原始数据 按行查看 历史
tony1981 提交于 2022-02-13 21:25 . init repo
--- xterm-146/fontutils.c Mon Sep 11 11:35:21 2000
+++ xterm-146-w/fontutils.c Tue Oct 24 01:07:37 2000
@@ -469,8 +469,17 @@
static int
is_fixed_font(XFontStruct *fs)
{
- return (fs->min_bounds.width == fs->max_bounds.width
- && fs->min_bounds.width == fs->min_bounds.width);
+ return (fs->min_bounds.width == fs->max_bounds.width);
+}
+
+/*
+ * Check if the font looks like a double width font (i.e. contains
+ * characters of width X and 2X
+ */
+static int
+is_double_width_font(XFontStruct *fs)
+{
+ return (2 * fs->min_bounds.width == fs->max_bounds.width);
}
#define EmptyFont(fs) ((fs)->ascent + (fs)->descent == 0 \
@@ -518,7 +527,7 @@
if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad;
if (EmptyFont(nfs))
goto bad; /* can't use a 0-sized font */
-
+
strcpy(normal, nfontname);
if (bfontname == 0) {
@@ -550,7 +559,7 @@
* fonts for 9x18 and 6x13.
*/
if_OPT_WIDE_CHARS(screen, {
- if (wfontname == 0) {
+ if (wfontname == 0 && !is_double_width_font(nfs)) {
fp = get_font_name_props(screen->display, nfs, normal);
if (fp != 0) {
wfontname = wide_font_name(fp);
@@ -593,13 +602,20 @@
}
}
+
+ /*
+ * We accept that the normal font is a double width font (such
+ * as the GNU unifont, so that we do not need to use the -fw
+ * option
+ */
+ if (is_double_width_font(nfs)) {
+ wfs = nfs;
+ } else if (!is_fixed_font(nfs)
+ || !is_fixed_font(bfs)
+ || nfs->max_bounds.width != bfs->max_bounds.width) {
/*
* Normal/bold fonts should be the same width. Also, the min/max
- * values should be the same.
- */
- if (!is_fixed_font(nfs)
- || !is_fixed_font(bfs)
- || nfs->max_bounds.width != bfs->max_bounds.width) {
+ * values should be the same. */
TRACE(("Proportional font! normal %d/%d, bold %d/%d\n",
nfs->min_bounds.width,
nfs->max_bounds.width,
@@ -770,7 +786,11 @@
{
int i, j, width, height;
- win->f_width = (font->max_bounds.width);
+ if (is_double_width_font(font)) {
+ win->f_width = (font->min_bounds.width);
+ } else {
+ win->f_width = (font->max_bounds.width);
+ }
win->f_height = (font->ascent + font->descent);
i = 2 * screen->border + sbwidth;
j = 2 * screen->border;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chaoswong/qemacs.git
git@gitee.com:chaoswong/qemacs.git
chaoswong
qemacs
qemacs
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385