2 Commits
15 changed files with 173 additions and 14 deletions

No files matched your search

+2
View File
@@ -10,6 +10,8 @@ where their state, file effects, and cancellation can be verified.
The [product goal](docs/NATIVE_PRODUCT_GOAL.md) defines compatibility and live
preview acceptance. The [publisher matrix](docs/PUBLISHER_TEMPLATE_MATRIX.md)
covers original journals, two-column journals, conferences, and arXiv.
The [local beta milestone](docs/NATIVE_PRODUCT_GOAL.md#beta-优先交付) describes
the first supported projects and the edit, preview, and export workflow.
## Native execution bootstrap
@@ -500,7 +500,7 @@ impl Default for VerticalBuilder {
fn default() -> Self {
Self {
nodes: Vec::new(),
prev_depth: -1000 * 65536,
prev_depth: super::parameters::IGNORE_DEPTH,
previous_lines: 0,
tail_path: Vec::new(),
}
@@ -526,7 +526,7 @@ impl VerticalBuilder {
pub fn append_box(&mut self, node: NativeVerticalNode, state: &State) -> Result<(), String> {
let (_, height, depth) = node.dimensions().expect("box or line");
if self.prev_depth > -1000 * 65536 {
if self.prev_depth > state.ignored_depth() {
let mut label = Parameter::Baselineskip;
let mut g = state.parameter(label).glue();
let gap = g.width as i64 - self.prev_depth as i64 - height;
@@ -542,6 +542,8 @@ impl Executor {
const XETEX_REVISION: &'static str = ".999998";
pub fn new(state: State, limits: Limits) -> Self {
let mut vertical = super::boxes::VerticalBuilder::default();
vertical.prev_depth = state.ignored_depth();
Self {
state,
limits,
@@ -594,7 +596,7 @@ impl Executor {
pdf_force_pagebox_warned: false,
input_position: None,
paragraph: None,
vertical: super::boxes::VerticalBuilder::default(),
vertical,
box_frames: Vec::new(),
box_nodes_created: 0,
material_charge: 0,
@@ -440,6 +440,7 @@ impl Executor {
if horizontal {
self.start_alignment_hlist(span);
} else {
self.vertical.prev_depth = self.read_ignored_depth();
self.normal_paragraph(files)?;
}
Ok(())
@@ -608,6 +609,8 @@ impl Executor {
.insert(Dependency::Parameter(Parameter::Lineskip));
self.reads
.insert(Dependency::Parameter(Parameter::Lineskiplimit));
self.reads
.insert(Dependency::Parameter(Parameter::Pdfignoreddimen));
let f = self.alignments.last_mut().unwrap();
self.vertical.append(&mut f.adjustments.pre);
self.vertical
@@ -717,6 +717,7 @@ impl Executor {
b.restricted = true;
self.paragraph = Some(b);
} else {
self.vertical.prev_depth = self.read_ignored_depth();
self.normal_paragraph(files)?;
}
if group == GroupKind::Insertion {
@@ -977,12 +978,18 @@ impl Executor {
}
Ok(())
}
pub(super) fn read_ignored_depth(&mut self) -> i32 {
self.reads.insert(Dependency::Parameter(Parameter::Pdfignoreddimen));
self.state.ignored_depth()
}
pub(super) fn append_vertical_box(&mut self, node: NativeVerticalNode) -> Result<(), Error> {
self.reads.insert(Dependency::VerticalState);
for p in [
Parameter::Baselineskip,
Parameter::Lineskip,
Parameter::Lineskiplimit,
Parameter::Pdfignoreddimen,
] {
self.reads.insert(Dependency::Parameter(p));
}
@@ -1016,7 +1023,7 @@ impl Executor {
return self
.fail("outer running rule requires native page packaging; specify width");
}
self.vertical.prev_depth = -1000 * 65536;
self.vertical.prev_depth = self.read_ignored_depth();
NativeVerticalNode::Rule(r)
}
_ => unreachable!(),
@@ -153,6 +153,7 @@ impl Executor {
let mut reads = BTreeSet::from([
Dependency::ParagraphMode,
Dependency::VerticalState,
Dependency::Parameter(Parameter::Pdfignoreddimen),
Dependency::PageState,
Dependency::FontResources,
Dependency::EscapeChar,
@@ -323,7 +324,7 @@ impl Executor {
render(&mut text, &mut reads, &vertical_nodes(&vertical.nodes))?;
text.push_str(auxiliary_break);
text.push_str("prevdepth ");
if vertical.prev_depth <= -1000 * 65536 {
if vertical.prev_depth <= self.state.ignored_depth() {
text.push_str("ignored");
} else {
text.push_str(&registers::print_scaled(vertical.prev_depth));
@@ -240,6 +240,7 @@ impl Executor {
math: std::mem::take(&mut self.math),
display: self.display.take(),
});
self.vertical.prev_depth = self.read_ignored_depth();
self.inputs.push(InputFrame::Tokens {
tokens: InputTokens::Many(tokens.iter().cloned().map(InputToken::from).collect()),
cursor: 0,
@@ -303,6 +304,7 @@ impl Executor {
self.display = frame.display;
let page = self.native_page.as_mut().unwrap();
page.output_active = false;
page.insertions.penalties = 0;
page.resume_contributions(nodes);
page.requested = true;
Ok(true)
@@ -16,9 +16,9 @@ use std::{
sync::{Arc, Mutex, OnceLock, Weak},
};
const SCHEMA: u32 = 111;
const COMPATIBLE_SCHEMAS: [u32; 77] = [
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, 107, 108, 109, 110, SCHEMA,
const SCHEMA: u32 = 112;
const COMPATIBLE_SCHEMAS: [u32; 78] = [
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, 107, 108, 109, 110, 111, SCHEMA,
];
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
@@ -247,6 +247,9 @@ impl FormatImage {
if image.schema < 111 {
image.state.install_pdf_font_tag_commands();
}
if image.schema < 112 {
image.state.restore_legacy_pdf_parameters(&Parameter::PDF_LINE_DIMENSIONS);
}
let pdf_objects = image.state.pdf_objects.as_deref();
let mut numbered_images = 0;
for (index, saved) in image.pdf_images.iter().enumerate() {
@@ -154,7 +154,6 @@ impl NativePageState {
self.max_depth = state.parameter(Parameter::Maxdepth).width();
self.least = AWFUL;
self.best = None;
self.insertions.penalties = 0;
if state.parameter(Parameter::Tracingpages).width() > 0 {
observations.push(PageObservation::Trace(PageTrace::Freeze {
goal: self.dimensions[0],
@@ -1535,6 +1535,16 @@ pub(super) fn finish(
let directions = super::direction::has_directions(&b.nodes);
let mut direction_stack = Vec::new();
let widow_kind = LinePenaltyKind::for_widow_parameter(final_widow);
let ignored_depth = state.ignored_depth();
let pdftex = state.input_profile() != super::InputProfile::XeTeX;
let line_dimension = |p| {
let value = parameters[&p].width();
(pdftex && value != ignored_depth).then_some(i64::from(value))
};
let each_height = line_dimension(Parameter::Pdfeachlineheight);
let each_depth = line_dimension(Parameter::Pdfeachlinedepth);
let first_height = line_dimension(Parameter::Pdffirstlineheight).or(each_height);
let last_depth = line_dimension(Parameter::Pdflastlinedepth).or(each_depth);
for (i, (point, bad)) in path.iter().enumerate() {
let mut material = line_material(
&b.nodes,
@@ -1558,7 +1568,7 @@ pub(super) fn finish(
// Keep a real breakpoint marker before the synthetic line closers.
super::direction::line(&mut material, &mut direction_stack);
}
let (line, line_box, adjustments, shrinking) = pack(
let (line, mut line_box, adjustments, shrinking) = pack(
&material,
&parameters,
dimensions,
@@ -1583,6 +1593,10 @@ pub(super) fn finish(
pre_display_size =
pre_display_line_size(material, line_box.setting, line_box.shift, quad);
}
let height = if i == 0 { first_height } else { each_height };
let depth = if i + 1 == path.len() { last_depth } else { each_depth };
line_box.height = height.unwrap_or(line_box.height);
line_box.depth = depth.unwrap_or(line_box.depth);
diagnostic_lines.push(super::diagnostics::box_view(&line_box));
line_boxes.push(line_box);
line_pre_adjustments.push(adjustments.pre);
@@ -1,6 +1,8 @@
//! Owned paragraph parameter meanings and TeX INITEX defaults.
use super::{Flex, Glue, RegisterKind, RegisterValue};
pub(super) const IGNORE_DEPTH: i32 = -1000 * 65536;
#[derive(
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
)]
@@ -148,6 +150,11 @@ pub enum Parameter {
Ignoreprimitiveerror,
Lastlinefit,
Savinghyphcodes,
Pdfignoreddimen,
Pdfeachlineheight,
Pdfeachlinedepth,
Pdffirstlineheight,
Pdflastlinedepth,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub enum ParameterValue {
@@ -155,6 +162,13 @@ pub enum ParameterValue {
Quantity(RegisterValue),
}
impl Parameter {
pub(super) const PDF_LINE_DIMENSIONS: [Self; 5] = [
Self::Pdfignoreddimen,
Self::Pdfeachlineheight,
Self::Pdfeachlinedepth,
Self::Pdffirstlineheight,
Self::Pdflastlinedepth,
];
pub(super) fn pdftex_only(self) -> bool {
matches!(
self,
@@ -191,6 +205,11 @@ impl Parameter {
| Self::Pdfprependkern
| Self::Pdfappendkern
| Self::Pdfadjustspacing
| Self::Pdfignoreddimen
| Self::Pdfeachlineheight
| Self::Pdfeachlinedepth
| Self::Pdffirstlineheight
| Self::Pdflastlinedepth
)
}
@@ -352,6 +371,11 @@ impl Parameter {
Self::XeTeXinputnormalization,
Self::Lastlinefit,
Self::Savinghyphcodes,
Self::Pdfignoreddimen,
Self::Pdfeachlineheight,
Self::Pdfeachlinedepth,
Self::Pdffirstlineheight,
Self::Pdflastlinedepth,
];
pub fn name(self) -> String {
match self {
@@ -381,6 +405,11 @@ impl Parameter {
| Self::Pdflinkmargin
| Self::Pdfdestmargin
| Self::Pdfthreadmargin
| Self::Pdfignoreddimen
| Self::Pdfeachlineheight
| Self::Pdfeachlinedepth
| Self::Pdffirstlineheight
| Self::Pdflastlinedepth
| Self::Delimitershortfall
| Self::Predisplaysize
| Self::Displaywidth
@@ -422,10 +451,10 @@ impl Parameter {
pub fn initial(self) -> ParameterValue {
if let Some(kind) = self.kind() {
ParameterValue::Quantity(if kind == RegisterKind::Dimen {
RegisterValue::Dimension(if matches!(self, Self::Pdfhorigin | Self::Pdfvorigin) {
4_736_287
} else {
0
RegisterValue::Dimension(match self {
Self::Pdfhorigin | Self::Pdfvorigin => 4_736_287,
p if Self::PDF_LINE_DIMENSIONS.contains(&p) => IGNORE_DEPTH,
_ => 0,
})
} else {
RegisterValue::Glue(Glue::default())
@@ -1645,6 +1645,14 @@ impl State {
self.assign_parameter(Parameter::Pdfoutput, ParameterValue::Integer(1), true);
self
}
pub(super) fn ignored_depth(&self) -> i32 {
if self.input_profile() == super::InputProfile::XeTeX {
super::parameters::IGNORE_DEPTH
} else {
self.parameter(Parameter::Pdfignoreddimen).width()
}
}
pub fn parameter(&self, parameter: Parameter) -> ParameterValue {
self.parameters
.get(&parameter)
@@ -332,6 +332,45 @@ fn output_groups_can_wrap_drop_and_reinsert_real_box255_material() {
}
}
#[test]
fn insertion_penalties_survive_page_freeze_and_clear_before_aftergroup() {
let output = r"\showbox255\shipout\box255\insertpenalties=19\aftergroup\AfterOutput";
let body = format!(
r"\def\AfterOutput{{{}}}
\count32=1000 \dimen32=20pt \skip32=0pt \insertpenalties=7
\hbox{{A}}{}
\insert32{{\hbox{{Note}}}}\penalty-10000
\hbox{{B}}\penalty-10000",
observe(r"return=\the\insertpenalties"),
observe(r"frozen=\the\insertpenalties"),
);
compare(&body, output);
}
#[test]
fn pdftex_line_box_dimensions_drive_vertical_glue_and_page_geometry() {
let body = format!(
r"\vsize=55pt\hsize=45pt\baselineskip=14pt\lineskiplimit=0pt\lineskip=2pt
\pdfignoreddimen=-21pt
\pdfeachlineheight=8pt\pdfeachlinedepth=2pt
\pdffirstlineheight=13pt\pdflastlinedepth=6pt
\setbox0=\vbox{{{}
\noindent First\hfil\penalty-10000 Middle\hfil\penalty-10000 Last\par
}}
\unvbox0\penalty-10000
\pdffirstlineheight=\pdfignoreddimen\pdflastlinedepth=\pdfignoreddimen
\hrule height1pt {}
\noindent Additional line\par
\penalty-10000",
observe(r"nested=\the\prevdepth"),
observe(r"after-rule=\the\prevdepth"),
);
compare(
&body,
&format!(r"{}\showbox255\shipout\box255", observe(r"output=\the\prevdepth")),
);
}
#[test]
fn actual_page_marks_carry_by_output_attempt_and_remain_separate_from_split_marks() {
let mut jobs = 0;
+20
View File
@@ -2,6 +2,26 @@
本文件记录用户重申的最终目标,是短期 goal、实现优先级和验收标准的上位约束。
## Beta 优先交付
先交付可试用的 Route-D 本地编辑器和原生 CLI。试用范围列明已实际对照的
文档类型、编译模式和资源配置。共享库、CLI 与编辑器使用同一编译结果。
选择一个构建和一组固定资源,提供启动方式、样例项目及已知差异。
- 首批项目采用既有原样 arXiv、PLOS ONE、Elsevier CAS 双栏、IEEE 会议和
NeurIPS 2025。复用已有参考产物,在发布候选上核对能打开和导出、关键页布局
及引用或文献流程。Beta 范围按实际通过的项目公布。
- 用原样多文件项目在编辑器核对首次预览、正文和子文件改动、连续输入、错误
诊断、恢复及 PDF 下载。保留上次完整发布并核对关键编辑与独立全量一致。
多页样例检查受影响的页面确实更新。
- 记录该构建在实际试用机器上的首次预览与典型编辑到页面可见的耗时,随 Beta
公布测试范围及已知限制。100 ms、分规模项目的正式采样、完整出版模板矩阵
与 W0–W7 全量验收属于正式版的退出条件。
首项工作是把现有原生编辑器、匹配的格式与资源和代表样例整理成可重复运行的
本地试用入口。按试用项目遇到的实际编译阻塞和可见时延排定后续功能。Beta 之后
继续扩大兼容性和性能覆盖,并按 P0–P5 完成正式版验收及产品切换。
## 2026-11-29 按真实项目推进功能批次
每批解决一个能影响现有项目迁移或实时编辑的共用问题,并提交可运行的结果。
+30
View File
@@ -18,6 +18,36 @@
| W6 会话 | 实施中 | 共享库/CLI 与当前原生文字/数学/规则来源进入公共结果;真实 A4 副本九类/27 revision 与独立干净作业页面/PDF/aux/映射一致,新增数学场景独立参考通过;详细失败/捕获重放及宿主/离线/CLI观察已通过;原子项目版本/已知生成初态及TeX流记录已接通;原样 12 页 NeurIPS 的中部编辑与恢复已验证前后缀复用、仅更新一页,且与独立全量一致。全部副作用/交叉编辑、旧来源与正式性能门禁仍待闭合 |
| W7 总验收 | 未满足 | 原有和新增测试、原样项目、格式与会话门禁全部通过才能结项 |
## 2026-11-29 行盒尺寸、分页返回与本地 Beta 验证
pdfTeX 的每行、首行和末行高度深度参数进入实际段落行盒。首行高度
和末行深度优先于一般值。当前 \pdfignoreddimen 决定何时插入基线胶,
并用于竖盒、对齐单元、竖向标尺和输出例程的 prevdepth 语义。
XeTeX 沿用自己的固定阈值。schema112 实际保存参数,旧格式继续加载,
已经存在的同名绑定保留。用户输出例程返回时清零 \insertpenalties,
页面首次冻结尺寸时保留该整数。原版 INITEX 见证在返回钩子中显示
0,原生旧版显示 19,候选的两页文字与原版一致。
[pdfTeX 行盒尺寸规则](https://github.com/TeX-Live/texlive-source/blob/e49735c7ed1aa2ed9c2e68e6632d27f20d42eca7/texk/web2c/pdftexdir/pdftex.web#L25927-L25955)
· [输出例程返回](https://github.com/TeX-Live/texlive-source/blob/e49735c7ed1aa2ed9c2e68e6632d27f20d42eca7/texk/web2c/pdftexdir/pdftex.web#L28570-L28591)
七项定向检查通过。双栏浮动、跨页长表、启用五个行距参数的双栏
浮动三个小项目使用实际 LaTeX 类和包,从空辅助文件各编译两轮。
两端共七页、1,276 个词框、144 DPI 灰度图和各轮 aux 均一致。
保留旧版在新样例首个参数处的真实编译失败。
本地 Beta 路线以 [产品总目标](NATIVE_PRODUCT_GOAL.md#beta-优先交付)
为准。本轮用同一发布构建启动原样 A4 多文件样例。Edge 实际绘制
首轮页面,共同修改主文件和子文件后更新这一页,编辑后来源表
包含当前子文件的实际版本。输入未定义命令时保留上次可下载 PDF,
恢复后导出与此前字节相同。独立 CLI 从空辅助文件编译两轮,收敛
后的 PDF 和 aux 均与编辑器逐字节一致。第一次拷入现成 aux 被
输出所有权检查拒绝,保留该失败。浏览器本次首屏为 4.56 秒,
两文件改动到页面可见为 0.96 秒,均为单次记录。Beta 还需整理
可重复的启动资源并在同一候选上走完首批原样项目。
证据在 target/p3-float-page-lists/。SHA256SUMS 指纹为
7ca1f8577db0f738144d36f5ac40d8a41c27a9b8e167e525696ed9e2aaba3d70。
## 2026-11-29 子文件检查点的所有权与分配
子文件推进后的执行器直接接回运行中的作业,在实际落点由统一调度保留