Expose active insertion height to pdfTeX macros
This commit is contained in:
1 parent
2fa11fb971
commit
7707cd9b09
7 files changed
+70
-4
No files matched your search
@@ -1033,6 +1033,7 @@ impl Executor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Pdfximagebbox => self.expand_pdf_image_bbox(token, files)?,
|
Pdfximagebbox => self.expand_pdf_image_bbox(token, files)?,
|
||||||
|
Pdfinsertht => self.expand_pdf_insertion_height(token, files)?,
|
||||||
Pdfstrcmp => {
|
Pdfstrcmp => {
|
||||||
let left = self.scan_expanded_group(files)?;
|
let left = self.scan_expanded_group(files)?;
|
||||||
let left = self.token_list_text(&left);
|
let left = self.token_list_text(&left);
|
||||||
|
|||||||
@@ -77,6 +77,21 @@ impl Executor {
|
|||||||
.dimension(p.page_dimension().unwrap());
|
.dimension(p.page_dimension().unwrap());
|
||||||
i32::try_from(value).map_err(|_| self.error("native page dimension overflow", self.current))
|
i32::try_from(value).map_err(|_| self.error("native page dimension overflow", self.current))
|
||||||
}
|
}
|
||||||
|
pub(super) fn expand_pdf_insertion_height(
|
||||||
|
&mut self, token: &Token, files: &mut impl SourceProvider,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let index = self.register_index(files)?;
|
||||||
|
self.reads.insert(Dependency::PageState);
|
||||||
|
let height = u8::try_from(index).ok().and_then(|class| {
|
||||||
|
self.native_page.as_ref()?.insertions.height(class)
|
||||||
|
});
|
||||||
|
let value = height.map_or_else(
|
||||||
|
|| "0pt".to_owned(),
|
||||||
|
|size| format!("{}pt", super::super::registers::print_scaled_wide(size)),
|
||||||
|
);
|
||||||
|
self.print_tokens(&value, token)
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn request_page(&mut self) {
|
pub(super) fn request_page(&mut self) {
|
||||||
if self.outer_vertical() {
|
if self.outer_vertical() {
|
||||||
if let Some(page) = self.native_page.as_mut() {
|
if let Some(page) = self.native_page.as_mut() {
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ use std::{
|
|||||||
sync::{Arc, Mutex, OnceLock, Weak},
|
sync::{Arc, Mutex, OnceLock, Weak},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SCHEMA: u32 = 106;
|
const SCHEMA: u32 = 107;
|
||||||
const COMPATIBLE_SCHEMAS: [u32; 72] = [
|
const COMPATIBLE_SCHEMAS: [u32; 73] = [
|
||||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, SCHEMA,
|
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, SCHEMA,
|
||||||
];
|
];
|
||||||
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
@@ -232,6 +232,9 @@ impl FormatImage {
|
|||||||
if image.schema < 106 {
|
if image.schema < 106 {
|
||||||
image.state.install_pdf_image_query_command();
|
image.state.install_pdf_image_query_command();
|
||||||
}
|
}
|
||||||
|
if image.schema < 107 {
|
||||||
|
image.state.install_pdf_insertion_query_command();
|
||||||
|
}
|
||||||
let pdf_objects = image.state.pdf_objects.as_deref();
|
let pdf_objects = image.state.pdf_objects.as_deref();
|
||||||
let mut numbered_images = 0;
|
let mut numbered_images = 0;
|
||||||
for (index, saved) in image.pdf_images.iter().enumerate() {
|
for (index, saved) in image.pdf_images.iter().enumerate() {
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ fn scale(size: i64, factor: i64) -> i64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PageInsertions {
|
impl PageInsertions {
|
||||||
|
pub(super) fn height(&self, class: u8) -> Option<i64> {
|
||||||
|
self.classes.get(&class).map(|entry| entry.size)
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn activity<'a>(
|
pub(super) fn activity<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
state: &'a State,
|
state: &'a State,
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ pub enum Primitive {
|
|||||||
Pdfrefximage,
|
Pdfrefximage,
|
||||||
Pdflastximage,
|
Pdflastximage,
|
||||||
Pdfximagebbox,
|
Pdfximagebbox,
|
||||||
|
Pdfinsertht,
|
||||||
Pdflastximagepages,
|
Pdflastximagepages,
|
||||||
Pdflastximagecolordepth,
|
Pdflastximagecolordepth,
|
||||||
Jobname,
|
Jobname,
|
||||||
@@ -533,6 +534,7 @@ impl Primitive {
|
|||||||
| XeTeXselectorname
|
| XeTeXselectorname
|
||||||
| Pdfstrcmp
|
| Pdfstrcmp
|
||||||
| Pdfximagebbox
|
| Pdfximagebbox
|
||||||
|
| Pdfinsertht
|
||||||
| Pdfmatch
|
| Pdfmatch
|
||||||
| Pdflastmatch
|
| Pdflastmatch
|
||||||
| Pdfuniformdeviate
|
| Pdfuniformdeviate
|
||||||
@@ -952,6 +954,7 @@ const PDFTEX_ONLY_PRIMITIVES: &[(&str, Primitive)] = {
|
|||||||
("pdfrefximage", Pdfrefximage),
|
("pdfrefximage", Pdfrefximage),
|
||||||
("pdflastximage", Pdflastximage),
|
("pdflastximage", Pdflastximage),
|
||||||
("pdfximagebbox", Pdfximagebbox),
|
("pdfximagebbox", Pdfximagebbox),
|
||||||
|
("pdfinsertht", Pdfinsertht),
|
||||||
("pdflastximagepages", Pdflastximagepages),
|
("pdflastximagepages", Pdflastximagepages),
|
||||||
("pdflastximagecolordepth", Pdflastximagecolordepth),
|
("pdflastximagecolordepth", Pdflastximagecolordepth),
|
||||||
("pdfcreationdate", Pdfcreationdate),
|
("pdfcreationdate", Pdfcreationdate),
|
||||||
@@ -2015,6 +2018,11 @@ impl State {
|
|||||||
self.update_profile_command("pdfximagebbox", Meaning::Primitive(Primitive::Pdfximagebbox), enabled);
|
self.update_profile_command("pdfximagebbox", Meaning::Primitive(Primitive::Pdfximagebbox), enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn install_pdf_insertion_query_command(&mut self) {
|
||||||
|
let enabled = self.input_profile != super::InputProfile::XeTeX;
|
||||||
|
self.update_profile_command("pdfinsertht", Meaning::Primitive(Primitive::Pdfinsertht), enabled);
|
||||||
|
}
|
||||||
|
|
||||||
fn install_pdftex_primitives(&mut self) {
|
fn install_pdftex_primitives(&mut self) {
|
||||||
let enabled = self.input_profile != super::InputProfile::XeTeX;
|
let enabled = self.input_profile != super::InputProfile::XeTeX;
|
||||||
for &(name, primitive) in PDFTEX_ONLY_PRIMITIVES {
|
for &(name, primitive) in PDFTEX_ONLY_PRIMITIVES {
|
||||||
|
|||||||
@@ -19,4 +19,4 @@
|
|||||||
\binoppenalty=700 \relpenalty=500
|
\binoppenalty=700 \relpenalty=500
|
||||||
\hsize=100pt \baselineskip=12pt \parfillskip=0pt plus1fil
|
\hsize=100pt \baselineskip=12pt \parfillskip=0pt plus1fil
|
||||||
\hbadness=10000 \vbadness=10000 \boxmaxdepth=100pt
|
\hbadness=10000 \vbadness=10000 \boxmaxdepth=100pt
|
||||||
\pdfoutput=0\showboxbreadth=1000\showboxdepth=100\overfullrule=0pt \vsize=64pt \topskip=10pt \maxdepth=2pt \splitmaxdepth=1pt \splittopskip=8pt \tracingpages=1 \count42=1000 \dimen42=56pt \skip42=3pt plus1pt \output={\message{[output:\the\insertpenalties,\the\pagetotal,\the\pagegoal]}\ifvoid42\message{[insert:void]}\else\message{[insert:\the\ht42,\the\dp42]}\fi \setbox0=\vbox{\unvbox255\ifvoid42\else\kern1pt\box42\fi}\showbox0\shipout\box0}\dimen42=13pt \floatingpenalty=11 \noindent A\insert42{\hbox{I}\penalty0\hbox{J}\penalty0\hbox{K}}B\par\noindent C\par\end
|
\pdfoutput=0\showboxbreadth=1000\showboxdepth=100\overfullrule=0pt \vsize=64pt \topskip=10pt \maxdepth=2pt \splitmaxdepth=1pt \splittopskip=8pt \tracingpages=1 \count42=1000 \dimen42=56pt \skip42=3pt plus1pt \output={\message{[output:\the\insertpenalties,\the\pagetotal,\the\pagegoal]}\message{[insert:output-height=\pdfinsertht42]}\ifvoid42\message{[insert:void]}\else\message{[insert:\the\ht42,\the\dp42]}\fi \setbox0=\vbox{\unvbox255\ifvoid42\else\kern1pt\box42\fi}\showbox0\shipout\box0}\dimen42=13pt \floatingpenalty=11 \message{[insert:absent=\pdfinsertht42]} \noindent A\insert42{\hbox{I}\penalty0\hbox{J}\penalty0\hbox{K}}B\par\message{[insert:split-height=\pdfinsertht42]}\noindent C\par\end
|
||||||
@@ -18,6 +18,41 @@
|
|||||||
| W6 会话 | 实施中 | 共享库/CLI 与当前原生文字/数学/规则来源进入公共结果;真实 A4 副本九类/27 revision 与独立干净作业页面/PDF/aux/映射一致,新增数学场景独立参考通过;详细失败/捕获重放及宿主/离线/CLI观察已通过;原子项目版本/已知生成初态及TeX流记录已接通;完整副作用/恢复契约、旧来源和性能仍缺 |
|
| W6 会话 | 实施中 | 共享库/CLI 与当前原生文字/数学/规则来源进入公共结果;真实 A4 副本九类/27 revision 与独立干净作业页面/PDF/aux/映射一致,新增数学场景独立参考通过;详细失败/捕获重放及宿主/离线/CLI观察已通过;原子项目版本/已知生成初态及TeX流记录已接通;完整副作用/恢复契约、旧来源和性能仍缺 |
|
||||||
| W7 总验收 | 未满足 | 原有和新增测试、原样项目、格式与会话门禁全部通过才能结项 |
|
| W7 总验收 | 未满足 | 原有和新增测试、原样项目、格式与会话门禁全部通过才能结项 |
|
||||||
|
|
||||||
|
## 2026-11-28 活动页面的插入高度和原样项目核查
|
||||||
|
|
||||||
|
pdfTeX 模式的可展开 \pdfinsertht 直接读取页构建中实际插入类
|
||||||
|
的未缩放尺寸,跟随当前页的正常计入、拆分、暂留和输出例程。
|
||||||
|
原版没有活动类时返回 0pt。schema107 保存该原语的别名,旧
|
||||||
|
schema106 的同名用户宏仍保留。
|
||||||
|
[pdfTeX 的展开与活动插入表](https://github.com/TeX-Live/texlive-source/blob/fb6158926661cb7a7246b3a94a0cb170a9624d5a/texk/web2c/pdftexdir/pdftex.web#L11405-L11414)
|
||||||
|
|
||||||
|
原版三页对照的查询依次为 0、10、14、14 pt,输出例程中归零。
|
||||||
|
页目标与三页 144 DPI 灰度图也一致。真实双栏 article 中,
|
||||||
|
左右栏脚注分别为 9.54001 和 28.54001 pt。依尺寸排出的规则、
|
||||||
|
整页光栅和 aux 与参考一致。既有插入套件的七页盒列表、分页和
|
||||||
|
DVI 合格,且覆盖新增查询。发布构建通过。
|
||||||
|
|
||||||
|
三页会话的检查点包含已经进入当前页的 10 pt 插入材料。两次
|
||||||
|
编辑各复用 1,326 步。第二页的插入高度更新到 19 pt 后恢复
|
||||||
|
为 15 pt,仅替换该页。PDF、预览、来源映射、日志和 aux 与
|
||||||
|
同修订独立全量一致。回执保留第一次空辅助文件导致零复用的
|
||||||
|
记录,复用对照固定实际生成文件初态。
|
||||||
|
|
||||||
|
基线 2fa11fb 复验原样六页 xeCJK-example-CJKfntef.tex。
|
||||||
|
六页词序、词框、144 DPI 灰度图和 aux 与参考一致。两端都
|
||||||
|
有十个字体条目,SimSun 合为同一子集,LASY6 为 Type 1C。
|
||||||
|
字体名、嵌入类型和 Unicode 标志的这组记录继续保留。完整
|
||||||
|
字体对象等价和双 profile 统一门禁单独验收。
|
||||||
|
|
||||||
|
根据用户对推进速度的反馈,后续按真实项目的阻塞链和 A4 热编辑
|
||||||
|
链路合并实现。开发用已有最小对照定位首处差异,发布构建与项目
|
||||||
|
回归按实现批次执行。下一批优先做 A4 主文件从检查点恢复到可见
|
||||||
|
页面的执行与布局复用。100 ms 预算和其他原有退出条件保持。
|
||||||
|
|
||||||
|
回执在 target/p3-native-insertion-height,receipt.json 的 SHA-256 为
|
||||||
|
be132ac806c3da49a48f37e2dfbba11f0965a3d9dcfc05805bbe2d0fd22af32e。
|
||||||
|
原样 xeCJK 主线记录在 target/p3-xecjk-current-batch。
|
||||||
|
|
||||||
## 2026-11-28 原生 PDF 图像页框查询
|
## 2026-11-28 原生 PDF 图像页框查询
|
||||||
|
|
||||||
pdfTeX 模式执行可展开的 \pdfximagebbox。通过实际图像对象编号
|
pdfTeX 模式执行可展开的 \pdfximagebbox。通过实际图像对象编号
|
||||||
|
|||||||
Reference in new issue
Block a user