Record pdfTeX margin behavior and capture checkpoint evidence

This commit is contained in:
gloamxun committed 2026-11-19 20:15:49 +08:00
1 parent ee22f25ee0
commit 11063c65dd
4 files changed
+93

No files matched your search

+28
View File
@@ -524,6 +524,34 @@ pdfTeX 一致。旧原生在 `lipsum.ltd` 缺失处停止。回执
SHA-256 为 `3f65e945629d6da49af4ee59ef0fe7285e3dde5e98b46397b069b8756943d8b8`。独立全量回执 `full-equivalence/receipt.json`
SHA-256 为 `ca8cc3879c21de6369230b14c51ac3435fd9bb8b6fc0b73f795b7f49ae100858`。
### 正则捕获的检查点与字符悬挂参考
在主线 `ee22f25` 基础上复用已验证的 POSIX 正则组件,独立组合
`\pdfmatch`、`\pdflastmatch` 与 TeX 默认后缀查找。捕获字节及其位置随
同一作业的执行检查点续跑,新作业清空捕获内容。原生候选按真实 pdfTeX
的18个匹配观察对照,并在读过匹配表达式后编辑未读后缀,核对恢复执行
与全量的完整事件序列。格式、后缀、项目资源及匹配共17项定向测试通过。
候选仍限 GNU/Linux,正则调用的内部取消与端到端延迟需单独验证。
`target/p3-pdf-match-with-input/{candidate.patch,directed.log}` 的 SHA-256
分别为 `cc3ca430c91b09e7aa8e49f39c3e4f0b687c80f7ed47af0974ec03c3923813ff`
和 `e73f75e9b0084ea4eaec4ba82dc1fb8a1f93295708eca0769d5a87058114a692`。
[TeX Live 的匹配及捕获实现](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/utils.c#L762-L852)
已用真实 pdfTeX 1.40.29 固定两个字符悬挂探针。相同的文字和行宽在
`\pdfprotrudechars` 为 0、1、2 时分别为 2、2、1 行。第一个词的
可见横坐标为 72.000、70.755、70.755 PDF 点。级别1与2均输出实际左右
边缘 kern,级别2同时将其计入断行候选。从组内给特定字体设置
`\lpcode`、`\rpcode` 后,两值按 ±1000 截断并保留至组外,
`\pdfprotrudechars` 恢复原值,另一字号的同字体仍有独立的代码。
在 10 和 20 pt 两个字号上读取实际边缘 kern,验证字距随字体 quad
变化,`\unhcopy` 后边缘 kern 消失。续跑版应对同一编辑版本核对
断行、实际字形坐标、节点和来源位置。对照源、日志、PDF、词框及
指纹见 `target/p3-microtype-margin-reference/receipt.json`,
SHA-256 为 `6cfc2cacdf17cc1486b5c72708d63c0dd7c7b8f2dd9375df1e04a31f46ad3d88`。
[pdfTeX 字体边缘度量](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L19387-L19431)
[pdfTeX 断行候选处理](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/pdftexdir/pdftex.web#L23356-L23370)
### schema27 与主线兼容性
合并了真实重复盒及 PDF 书签布局,并保留主线的宏参数分隔符和流式失败报告。
+6
View File
@@ -6,3 +6,9 @@
references, and Letter paper.
- Compile the fixture by importing it as a project (ZIP upload) or by copying
the directory into `projects/` next to a `.meta` entry.
- `pdftex-margin-protrusion/` contains two plain pdfTeX reference probes.
`probes.tex` compares protrusion levels 0, 1, and 2 at the same line width.
`font-scope.tex` exercises font-specific codes, grouping, font scaling,
margin queries, and unboxing. Run each in a separate output directory
with `pdftex -interaction=nonstopmode -halt-on-error -no-shell-escape -recorder`.
[Reference observations](../docs/P2_M1_PROGRESS.md)
@@ -0,0 +1,31 @@
\pdfoutput=1
\pdfadjustspacing=0
\pdfprotrudechars=0
\font\face=cmr10 at 10pt
\font\bigface=cmr10 at 20pt
\face
\begingroup
\lpcode\face`A=-1200
\rpcode\face`!=1200
\pdfprotrudechars=2
\message{!scope:inside:[\the\lpcode\face`A]/[\the\rpcode\face`!]/[\the\pdfprotrudechars]:end!}
\endgroup
\message{!scope:outside:[\the\lpcode\face`A]/[\the\rpcode\face`!]/[\the\pdfprotrudechars]:end!}
\message{!scope:other-font:[\the\lpcode\bigface`A]/[\the\rpcode\bigface`!]:end!}
\lpcode\face`A=-125
\rpcode\face`!=400
\lpcode\bigface`A=-125
\rpcode\bigface`!=400
\pdfprotrudechars=1
\parfillskip=0pt
\rightskip=0pt plus 1fil
\hsize=45pt
\def\probe#1{%
\setbox0=\vbox{#1\noindent A!\par\global\setbox2=\lastbox}%
\message{!scope:line:[\leftmarginkern2]/[\rightmarginkern2]:end!}%
\setbox3=\hbox{\unhcopy2}%
\message{!scope:unboxed:[\leftmarginkern3]/[\rightmarginkern3]:end!}%
\shipout\vbox{\copy2\box3}}
\probe\face
\probe\bigface
\end
@@ -0,0 +1,28 @@
\pdfoutput=1
\pdfadjustspacing=0
\font\face=cmr10
\face
\lpcode\face`A=125
\rpcode\face`!=400
\spaceskip=3.33333pt
\rightskip=0pt plus 1fil
\emergencystretch=0pt
\parindent=0pt
\tolerance=100
\showboxbreadth=100
\showboxdepth=100
\tracingoutput=1
\setbox0=\hbox{A! B!}
\hsize=\wd0
\advance\hsize by -1pt
\def\shipprobe#1{%
\pdfprotrudechars=#1
\setbox0=\vbox{\noindent A! B!\par
\global\setbox2=\lastbox
\message{!margin-check:#1:[\leftmarginkern2]/[\rightmarginkern2]:end!}%
\box2}%
\shipout\box0}
\shipprobe0
\shipprobe1
\shipprobe2
\end