Recognize space aliases when scanning TeX quantities

This commit is contained in:
gloamxun committed 2026-11-28 08:20:52 +08:00
1 parent da48cf9cad
commit 69efe0b895
3 files changed
+44 -4

No files matched your search

@@ -261,7 +261,7 @@ impl Executor {
for (i, c) in keyword.chars().enumerate() {
let next = loop {
let next = self.expanded(files)?;
if i == 0 && next.as_ref().is_some_and(|t| t.token.kind.is_space()) {
if i == 0 && next.as_ref().is_some_and(|t| self.is_spacer(&t.token)) {
continue;
}
break next;
@@ -299,7 +299,7 @@ impl Executor {
}
pub(super) fn optional_space(&mut self, files: &mut impl SourceProvider) -> Result<(), Error> {
if let Some(t) = self.expanded(files)?
&& !t.token.kind.is_space()
&& !self.is_spacer(&t.token)
{
self.unread(t)?;
}
@@ -361,7 +361,7 @@ impl Executor {
TokenKind::Character('.' | ',', CatCode::Other)
) {
has_point = true;
} else if !t.token.kind.is_space() {
} else if !self.is_spacer(&t.token) {
self.unread(t)?;
}
break;
@@ -389,7 +389,7 @@ impl Executor {
digits.push(c as i64 - '0' as i64);
}
} else {
if !t.token.kind.is_space() {
if !self.is_spacer(&t.token) {
self.unread(t)?;
}
break;
@@ -238,6 +238,10 @@ fn native_units_glue_and_printing_match_actual_pdftex() {
r"{\let\out=\report\catcode112=12 \dimen0=1pT \out{\the\dimen0}}",
r"\dimen0=.pt \dimen1=1.25pt \report{\the\dimen0/\the\dimen1}",
r"\skip0=1pt plus2fil L L \report{\the\skip0}",
r"\def\bindspace#1{\let\endnumber= #1}\bindspace{ }\spaceskip=4pt\setbox0=\hbox{\kern-0.00017pt\endnumber\kern0.00017pt\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
r"\dimendef\widthreg=2\widthreg=2pt\setbox0=\hbox{\kern\widthreg\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
r"\setbox0=\hbox{\kern1pt\endnumber\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
r"\setbox0=\hbox{\hskip2pt\endnumber\endnumber plus3pt\endnumber\vrule width3pt height2pt}\report{\the\wd0}",
] {
cases.push(source.into());
}
+36
View File
@@ -819,6 +819,42 @@ letterspace-fresh.log 和 device-pdftex-spaced-moved.log。
[原版字距虚拟字体构造](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/pdftex.web#L16400-L16492)
[原版格式所写字体字段](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/pdftex.web#L30627-L30696)
### 数量扫描消费空格别名
六页原样 xeCJK 样稿第 1 页的下划线片段之间多出约 10.49 bp,
第 5 页标记正文也从片段交界出现断行差。提取同一格式与宏包的
三组盒列表后,首个相邻下划线片段处,旧原生把正负 kern 标记
拆开并夹入三份 3.50961 pt 的文字胶水。实际 LaTeX3 的 exp_stop_f
通过 let 绑定到空格命令,XeTeX 数量扫描按命令含义处理。
数字终止、尺寸单位后的单个可选空格和关键字起始空格复用当前
绑定的 spacer 查询。同一个 alias 在需要读取的地方保持正常
空格行为。直接的五页 XeTeX 对照通过。数值尺寸、内部量、双空格、
整数字面量和胶水关键字的盒宽与参考逐项一致,144 DPI 灰度图
也逐页相同。真实 ctexart 与 xeCJKfntef 的三组盒宽分别从
165.07816、28.09796、368.66667 pt 改为 126.47241、21.07874、
337.25977 pt,外层节点和 144 DPI 光栅与参考逐项一致。输入、
列表和数量的 23 项定向回归通过,并包含 pdfTeX 同源对照。
[参考关键字扫描](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/xetexdir/xetex.web#L9631-L9674)
[参考可选空格扫描](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/xetexdir/xetex.web#L10485-L10503)
四页会话更改前置子文件中的绑定,从空格改为普通字符。检查点随依赖
失效,重建后的预览只更新第 2 页。随后修改正文和从出页错误恢复,
分别复用 111 步,仍只更新第 2 页。成功修订的 PDF、测量页面、
SVG、来源映射和 aux 与独立全量编译一致。失败保留已发布版本和 aux。
原样六页 xeCJK-example-CJKfntef.tex 复编使用同一输入、字体和
冻结参考。六页的 999 个提取词、阅读顺序、词框和 144 DPI 灰度图
逐项一致,aux 逐字节相同。之前第 1、5、6 页的 15,300、
128,248 和 28,718 个光栅差异归零。本轮实际执行 70,764,867 步。
LASY6 的 PDF 嵌入编码和 SimSun 字体资源归并仍有结构差异。
下一入口保留上一阶段已证实的 e-TeX 拆盒无限 shrink 处理,
包括屏蔽位、实际有限胶水转换和引用该原语的页面标记路径。
原样 PDF、盒列表、对照脚本和增量证据在
target/p3-xecjk-box-spacing,receipt.json 为
1a8a9e30f3bfe16012fb703ff22573d30f0a54eef31e85a21f9cc0d52dd14514。
### 封装盒共享实际水平和垂直列表
封装后的水平和垂直列表通过共享所有权随盒副本进入状态和执行事件。