Round pdfTeX font expansion before quantizing the font step
This commit is contained in:
1 parent
9ae7c6a6df
commit
9e13cca481
3 files changed
+43
-1
No files matched your search
@@ -244,7 +244,10 @@ fn slot_ratio(state: &State, font: &NativeFont, slot: u8, line_ratio: i32) -> i3
|
|||||||
config.stretch
|
config.stretch
|
||||||
};
|
};
|
||||||
let code = state.fonts.expansion_code(font.id, slot);
|
let code = state.fonts.expansion_code(font.id, slot);
|
||||||
let magnitude = i64::from(line_ratio.abs()) * i64::from(code) * i64::from(max) / 1_000_000;
|
// Round the signed expansion product before quantizing it to the font step.
|
||||||
|
// Work on its magnitude here so both signs round away from zero at a tie.
|
||||||
|
let product = i64::from(line_ratio.abs()) * i64::from(code) * i64::from(max);
|
||||||
|
let magnitude = (product + 500_000) / 1_000_000;
|
||||||
let step = i64::from(config.step);
|
let step = i64::from(config.step);
|
||||||
(magnitude + step / 2).div_euclid(step) as i32 * config.step * line_ratio.signum()
|
(magnitude + step / 2).div_euclid(step) as i32 * config.step * line_ratio.signum()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2175,6 +2175,36 @@ PDF,恢复实际 PFB 并反转斜切时复用 1277 步,只替换第二页。
|
|||||||
全量编译一致。incremental-receipt.json 的 SHA-256 为
|
全量编译一致。incremental-receipt.json 的 SHA-256 为
|
||||||
bbc0991b0316e6d76aa58649ec873525f5544ab530d93fe491fc6e16bd00a27d。
|
bbc0991b0316e6d76aa58649ec873525f5544ab530d93fe491fc6e16bd00a27d。
|
||||||
|
|
||||||
|
### pdfTeX 字宽伸缩的两次量化
|
||||||
|
|
||||||
|
字形置换先按行伸缩比、`\efcode` 和字体上限计算最接近的整数,
|
||||||
|
再按该字体的步长量化。中间乘积的半值向远离零的方向取整。
|
||||||
|
段落装盒和候选边缘字体计算共用该规则。
|
||||||
|
[参考乘积取整](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/utils.c#L396-L406)
|
||||||
|
[参考字形置换](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/pdftex.web#L20833-L20849)
|
||||||
|
[参考字体档位量化](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/pdftex.web#L17548-L17576)
|
||||||
|
|
||||||
|
真实 CMR 的两页八盒覆盖正负方向及步长 1、4。档位依次为
|
||||||
|
+18、+19、−18、−19、+16、+20、−16、−20,全部与 pdfTeX
|
||||||
|
一致。词框完全一致,144 DPI 两页差异从 82、91 降为 0、0。
|
||||||
|
|
||||||
|
同一六项原样 arXiv 输入和冻结 schema78 重跑三轮及真实 BibTeX。
|
||||||
|
三轮 aux、bbl 与参考逐字节一致,最终无未定义引用。PDF 内容流
|
||||||
|
的 6918 个字形身份、顺序、字体大小、纵坐标和伸缩比例与参考
|
||||||
|
一致,先前 982 个伸缩比例差已归零。1221 个提取词同序。三页
|
||||||
|
144 DPI 差异由 8579、15230、949 降为 1457、2366、949,最大
|
||||||
|
词框差由 0.071900 bp 降到 0.039054 bp。
|
||||||
|
|
||||||
|
跨文件改变真实装盒宽度三次,覆盖步长 1 的正负临界点。各复用
|
||||||
|
99 步,仅更新第二页,字形档位、来源命中、PDF、SVG、来源映射
|
||||||
|
及 aux 与同初始状态的独立全量一致。
|
||||||
|
|
||||||
|
独立 CMR 的装盒探测保留下一处差异。两端选 +50‰ 时,实际
|
||||||
|
`AV` 字偶距在参考中为 −1.11113 pt,原生为 −1.16669 pt。
|
||||||
|
下一步对照字体置换前后的 kern 节点和相邻字体身份。回执
|
||||||
|
`target/p3-arxiv-expansion-quantization/receipt.json` 的 SHA-256 为
|
||||||
|
`f252c7b7dc4ea418d7364885b600c28d184d968db2cb9c07479a352083c012ac`。
|
||||||
|
|
||||||
### 原样 arXiv 三轮收敛与 pdfTeX 伸缩文字定位
|
### 原样 arXiv 三轮收敛与 pdfTeX 伸缩文字定位
|
||||||
|
|
||||||
原样 `pdflatex.ini` 重建 schema78,用时189.3秒。核验实际入口、
|
原样 `pdflatex.ini` 重建 schema78,用时189.3秒。核验实际入口、
|
||||||
|
|||||||
@@ -476,6 +476,15 @@ schema37 优化版使用冻结输入耗时197.5秒生成原样格式,LaTeX 自
|
|||||||
- `target/p3-margin-kern-query-native/format/receipt.json` 为 `a9484ec1c83d7f1f420028003f5f422a0e45b5bd7c06f62eb4c98252dc3cdf6d`。
|
- `target/p3-margin-kern-query-native/format/receipt.json` 为 `a9484ec1c83d7f1f420028003f5f422a0e45b5bd7c06f62eb4c98252dc3cdf6d`。
|
||||||
- `target/p3-margin-kern-query-native/arxiv/receipt.json` 为 `85b2ee927455fae5f72d4aeb8373ffd27d6452d21c8c8fceadbd4a3be3a0f9a2`。
|
- `target/p3-margin-kern-query-native/arxiv/receipt.json` 为 `85b2ee927455fae5f72d4aeb8373ffd27d6452d21c8c8fceadbd4a3be3a0f9a2`。
|
||||||
|
|
||||||
|
### 原样 arXiv 字宽伸缩量化复验
|
||||||
|
|
||||||
|
保持六份原样输入、冻结参考格式、字体映射和 schema78。原生和
|
||||||
|
参考各完成三轮 LaTeX 与一次独立 BibTeX。逐轮 aux、实际 bbl
|
||||||
|
与参考字节相同。三页 PDF 的 6918 个字形、1221 个提取词同序,
|
||||||
|
982 个字形的伸缩比例差归零。144 DPI 差异由 24758 降至 4772,
|
||||||
|
最大词框差为 0.039054 bp。字偶距和其余整页墨迹对照继续。
|
||||||
|
[阶段记录](P2_M1_PROGRESS.md#pdftex-字宽伸缩的两次量化)
|
||||||
|
|
||||||
### 原样 arXiv 三轮作业与 PDF 文字定位
|
### 原样 arXiv 三轮作业与 PDF 文字定位
|
||||||
|
|
||||||
用六项原样输入、冻结参考格式和字体映射继续至稳定输出。当前原样
|
用六项原样输入、冻结参考格式和字体映射继续至稳定输出。当前原样
|
||||||
|
|||||||
Reference in new issue
Block a user