实现 ConTeXt MkIV 中文标点压缩与边界对齐

这几天,抽了些时间,试图自行解决 ConTeXt MkIV 的标点压缩与边界对齐。由于 Hans 在新的 MkIV 中对 CJK 文字处理框架进行了修整,只需要很简单的一点 hack 工作,问题基本上就得以解决。现在总算有一点心满意足,可以继续耐心地等待 Hans 他们实现 MkIV 对中文排版的完善支持的那一天。

简单 show 一下效果,因为很少有人关注,主要是自我欣赏一下

我将 hack 过程整理成两份文档,可以从 http://bbs.ctex.org/viewthread.php?tid=48562&extra=page%3D1 下载。

Posted by LiYanrui Mar 25, 2009 05:10:58 PM


We need a perfect solution of Chinese support in TeX

These days I have tried to understand a few segments of source code about Chinese support in ConTeXt MkIV, because, with my own efforts, I want to solve the problem of Chinese puncuations appeared on the right side of pages which often affect the aesthetic feel of typesetting. I noticed that there two lines of code that look like unnecessary and I hide them with comment sign. After regenerating ConTeXt formats, I recompiled those documents that I have already finished including those in CTXnotes project. I found all is ok! Now Chinese puncuations never appear on the right side and the layout looks very tidy.

Posted by LiYanrui Oct 21, 2008 04:32:49 PM


被迫清心寡欲地使用中文字体

最近,ConTeXt MkIV 的混合字体机制出现了一个以前出现过的问题,即:在不同的 typescript 环境中(比如 Serif 和 Mono),如果向同一款中文字体的相同编码区域注入两种不同的西文字体,那么只有首次注入的西文字体才是有效的。That is to say, 只能是一款中文字体与一款英文字体进行混合。

Posted by LiYanrui Oct 19, 2008 05:42:37 PM


压缩标点之间的间距

昨天,耐心地阅读了 MkIV 的 font-otf.lua 最后那一部分处理中文的代码,终于看出了一点门道,并向其中添加了一小段代码用于压缩两个紧挨着的中文标点的间距。另外,font-otf.lua 也未对中文引号进行标点压缩,这个问题我也通过 hack 的方式解决了。

Posted by LiYanrui Oct 15, 2008 07:54:12 PM


首字下沉

Taco 从 LaTeX 的 lettrine.sty 宏包中 port 过来一个 t-lettrine,使得 ConTeXt 可以很方便地处理首字下沉问题。

\usetypescriptfile[type-gyr]
\usetypescript[palatino][qx]
\setupbodyfont[11pt,palatino]

\usemodule[lettrine]

\setuplettrine[Nindent=0pt]

\starttext

\lettrine{M}{an} was last to come but the first to use his brain for the purpose of conquering the forces of nature. That is the reason why we are going to study him, rather than cats or dogs or horses or any of the other animals, who, all in their own way, have a very interesting historical development behind them.

\stoptext

Posted by LiYanrui Oct 09, 2008 02:04:37 PM


flowchart 模块又可以正常工作

因为 flowchart 的流程图块之间的连接线的标注 (comment) 功能不可用,所以不用这个模块好长时间了。前段时间向 Hans 反映 MkIV 混合字体问题之时,顺便也报告了这个问题,不过没有引起重视。十之八九是他没看懂我的英文。昨天晚上,在邮件列表中终于看到有人再次反映了该问题,我很高兴。今天早上,直觉上认为已经修复了,于是更新了一下 Minimals,果然如此。 不过,似乎大家平日是不用这个模块的,否则这么久都没有人说这个事情。

Posted by LiYanrui Sep 22, 2008 04:16:33 PM


ConTeXt 中文章节与图表标题的设置

不知道原来 MkII 的那些中文环境的设置以后会不会迁移到 MkIV 的正式版本里。如果现在使用 MkIV 排版中文,要想实现章节的编号格式为“第 x 章”、“第 x 节”,或者实现图、表标题格式为“图 x”、“表 x”,可能需要自己来做一些有些 dirty 的工作。

Posted by LiYanrui Jun 26, 2008 05:02:58 AM