Emacs font backend

前几天在[水木 Emacs] 版看到有人说 Emacs Unicode 支持了 xft, 拿下来一看 ChangeLog.unicode, 如下:

  1. 2006-06-06  Kenichi Handa  <handa@m17n.org>
  2.  
  3.         * configure.in: New args --enable-font-backend, --with-xft,
  4.         --with-freetyp.  New AC_DEFINEs USE_FONT_BACKEND, HAVE_XFT,
  5.         HAVE_FREETYPE, HAVE_LIBOTF.  New AC_SUBSTs XFT_LIBS,
  6.         FREETYPE_CFLAGS, FREETYPE_LIBS, FONTCONFIG_CFLAGS,
  7.         FONTCONFIG_LIBS, LIBOTF_CFLAGS, LIBOTF_LIBS.
  8.  
  9.         * configure: Re-generated.

然后参照 README.unicode 开始编译和运行:

  1. This branch now contains new codes for handling fonts by multiple font
  2. backends.  The old font handling codes still exist completely parallel
  3. to the new codes, and the new codes are used only when you configure
  4. Emacs with the argument "--enable-font-backend" and run Emacs with the
  5. same argument.

还好这台 Linux 机器上一些开发包都有, 编译倒一点问题没有, 但一运行 (set-frame-font "Bitstream Vera Sans Mono") 就 core 了.

[Mailing List] 上, Handa 提到使用了多个 font driver 机制, 来选择不同的后端. 在 core 之后, 我就开始测试, 开始读代码. 以前没看过 Emacs 的代码, 现在一读, 感觉太乱了, 当然主要读的部分还是 Handa 加的那些字体处理方面的. 虽说整体上有所把握, 但细节的东西太多, 实在是看不太懂. 调试是有些结果的, 中间从 FontConfig 找字体也能够找到, 最后在 xftfont.c:191:xftfont_open() 函数中需要拿到一个字体的 full_name, 但函数里面根本没赋值, 导致最后寻找字体失败, 从而在其他的 driver 里面找一个替代的字体.

这是我研究的结果, 可以说是无功而返, 但其中开始了解了 Emacs 的一些代码, 也理解了有操作 List Object 的一些方面. 水木上有人成功了, [这个][这个]帖子看样子还是字体设置的问题, 但是感觉不对劲. 我觉得字体就应该是使用 FontConfig 那种命名方式, 而不再象 XLFD 一样. 不知道他们真正的设置是什么样的.

更新以后就解决了

这两天一直在看 Emacs 的 [Diff MailingList], 看 Handa 有没有更新, 不过一直没看到, 看到别人都可以, 我这里还是那天刚刚更新的, 是不是这两天还修改了一些? 刚才就又试着 update 一把, 果然是又有更新, 看 src/ChangeLog.unicode, 更新还不少. Linux 机器不能通外网, 还得在笔记本上打包拷贝过去, 好在速度比较快. 本来想用 rsync 的, 发现 rsync 还需要 cygwin, 遂放弃, 不过话说回来, 以后估计还得装个 cygwin, 好多工具都没有 MinGW 的移植.

以前的参数没变, 直接编译, 这么运行 ./src/emacs --enable-font-backend -fn "Bitstream Vera Sans Mono-15" -q, 结果如图

原来没有使用 XFT 的结果如图:

不过 bug 太多, C-u C-x = 都会 core, 刚才一段时间没动, 切换回去就又 core 了.

good post

this is a good post that i like it after i read it, so much thanks for sharing.http://mmpkgg.com

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • You can use BBCode tags in the text.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
  ____   __   __              _   __  __          _       _____ 
|___ \ \ \ / / _ __ ___ | | | \/ | ___ | |__ |___ /
__) | \ V / | '_ ` _ \ | | | |\/| | / __| | '_ \ |_ \
/ __/ | | | | | | | | | | | | | | | (__ | |_) | ___) |
|_____| |_| |_| |_| |_| |_| |_| |_| \___| |_.__/ |____/
Enter the code depicted in ASCII art style.