Compare commits
3
Commits
d02777a1fc
...
4bd7f1e08e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bd7f1e08e | ||
|
|
3ff339341b | ||
|
|
75d3667397 |
No files matched your search
@@ -356,7 +356,6 @@ impl Executor {
|
||||
// Compatibility level for the eight-bit native PDF interface.
|
||||
// This is independent of the Route-D build version.
|
||||
const PDFTEX_VERSION: i32 = 140;
|
||||
const PDFTEX_REVISION: &str = "22";
|
||||
|
||||
pub fn new(state: State, limits: Limits) -> Self {
|
||||
Self {
|
||||
@@ -999,7 +998,7 @@ impl Executor {
|
||||
self.print_tokens(&format!("{digest:X}"), token)?;
|
||||
}
|
||||
}
|
||||
Pdftexrevision => self.print_tokens(Self::PDFTEX_REVISION, token)?,
|
||||
Pdftexrevision => self.print_tokens(self.state.pdftex_revision(), token)?,
|
||||
Etexrevision => self.print_tokens(".6", token)?,
|
||||
Csname => {
|
||||
let name = self.csname(files)?;
|
||||
|
||||
@@ -100,7 +100,7 @@ impl Executor {
|
||||
if let Some(warning) = self.state.glyph_unicode.define(glyph, &value) {
|
||||
let text = format!("native PDF warning: {warning}");
|
||||
files
|
||||
.observe_message(&text)
|
||||
.observe_diagnostic(WriteDestination::TerminalAndLog, &format!("{text}\n"))
|
||||
.map_err(|e| self.error(e, self.current))?;
|
||||
self.events.push(Event::Message {
|
||||
text,
|
||||
@@ -200,7 +200,7 @@ impl Executor {
|
||||
"native PDF warning: object streams require PDF 1.5 or greater; disabled"
|
||||
.to_string();
|
||||
files
|
||||
.observe_message(&text)
|
||||
.observe_diagnostic(WriteDestination::TerminalAndLog, &format!("{text}\n"))
|
||||
.map_err(|e| self.error(e, self.current))?;
|
||||
self.events.push(Event::Message {
|
||||
text,
|
||||
|
||||
@@ -8,9 +8,9 @@ use std::{
|
||||
sync::{Arc, Mutex, OnceLock, Weak},
|
||||
};
|
||||
|
||||
const SCHEMA: u32 = 50;
|
||||
const COMPATIBLE_SCHEMAS: [u32; 19] = [
|
||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, SCHEMA,
|
||||
const SCHEMA: u32 = 51;
|
||||
const COMPATIBLE_SCHEMAS: [u32; 20] = [
|
||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, SCHEMA,
|
||||
];
|
||||
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
|
||||
@@ -603,6 +603,16 @@ mod ordered_map {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
enum PdftexRevision {
|
||||
// A format created before revision identity was stored bootstrapped with 22.
|
||||
#[default]
|
||||
#[serde(rename = "22")]
|
||||
R22,
|
||||
#[serde(rename = "24")]
|
||||
R24,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct State {
|
||||
#[serde(with = "ordered_map")]
|
||||
@@ -613,6 +623,8 @@ pub struct State {
|
||||
#[serde(with = "ordered_map")]
|
||||
pub(super) token_parameters: BTreeMap<TokenParameter, std::sync::Arc<[Token]>>,
|
||||
profile: Profile,
|
||||
#[serde(default)]
|
||||
pdftex_revision: PdftexRevision,
|
||||
initex: bool,
|
||||
#[serde(default)]
|
||||
input_profile: super::InputProfile,
|
||||
@@ -734,6 +746,7 @@ impl Default for State {
|
||||
toks: BTreeMap::new(),
|
||||
token_parameters: BTreeMap::new(),
|
||||
profile: Profile::Bootstrap,
|
||||
pdftex_revision: PdftexRevision::R24,
|
||||
initex: false,
|
||||
input_profile: super::InputProfile::default(),
|
||||
endlinechar: 13,
|
||||
@@ -1389,6 +1402,12 @@ impl State {
|
||||
pub fn profile(&self) -> Profile {
|
||||
self.profile
|
||||
}
|
||||
pub(super) fn pdftex_revision(&self) -> &'static str {
|
||||
match self.pdftex_revision {
|
||||
PdftexRevision::R22 => "22",
|
||||
PdftexRevision::R24 => "24",
|
||||
}
|
||||
}
|
||||
pub fn tokens(&self, index: u16) -> Vec<Token> {
|
||||
self.toks.get(&index).cloned().unwrap_or_default()
|
||||
}
|
||||
|
||||
@@ -21,12 +21,14 @@ fn source(name: &str, text: &str) -> SourceFile {
|
||||
|
||||
#[test]
|
||||
fn legal_dump_loads_owned_format_state_into_a_new_job() {
|
||||
let seed = SEED.replace(r"\dump", r"\edef\frozenrevision{\pdftexrevision}\dump");
|
||||
let time = JobTime::new(2026, 1, 2, 123).unwrap();
|
||||
let state = State::initex()
|
||||
.with_etex()
|
||||
.with_input_profile(InputProfile::TeX8Bit)
|
||||
.with_job_time(JobTime::new(2025, 2, 3, 21).unwrap());
|
||||
let dump = Executor::new(state.clone(), Limits::default())
|
||||
.run(source("seed.tex", SEED), &mut Host)
|
||||
.run(source("seed.tex", &seed), &mut Host)
|
||||
.unwrap();
|
||||
let format = FormatImage::from_dump(dump, Vec::new(), Vec::new())
|
||||
.unwrap()
|
||||
@@ -42,10 +44,13 @@ fn legal_dump_loads_owned_format_state_into_a_new_job() {
|
||||
)
|
||||
};
|
||||
assert!(load(b"changed").is_err());
|
||||
let job = load(SEED.as_bytes())
|
||||
let job = load(seed.as_bytes())
|
||||
.unwrap()
|
||||
.run(
|
||||
source("document.tex", r"\message{\frozen-\the\count0}\end"),
|
||||
source(
|
||||
"document.tex",
|
||||
r"\message{\frozen-\the\count0}\message{REV=\frozenrevision/\pdftexrevision}\end",
|
||||
),
|
||||
&mut Host,
|
||||
)
|
||||
.unwrap();
|
||||
@@ -57,7 +62,7 @@ fn legal_dump_loads_owned_format_state_into_a_new_job() {
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(messages, ["HOOK=123", "READY-42"]);
|
||||
assert_eq!(messages, ["HOOK=123", "READY-42", "REV=24/24"]);
|
||||
assert!(!job.state.is_initex());
|
||||
assert!(!job.format_dumped);
|
||||
let mut corrupt = format.clone();
|
||||
@@ -69,7 +74,7 @@ fn legal_dump_loads_owned_format_state_into_a_new_job() {
|
||||
.run(source("bad.tex", r"\begingroup\dump"), &mut Host)
|
||||
.unwrap_err();
|
||||
assert!(grouped.message.contains("closed groups"));
|
||||
let ordinary = load(SEED.as_bytes())
|
||||
let ordinary = load(seed.as_bytes())
|
||||
.unwrap()
|
||||
.run(source("bad.tex", r"\dump"), &mut Host)
|
||||
.unwrap_err();
|
||||
|
||||
@@ -1557,6 +1557,29 @@ SVG、诊断文件和归一化来源映射均与独立零复用全量一致。
|
||||
未修改的 LaTeX 格式和原样 ACM 的本地结构目的地做验收。
|
||||
[TeX Live 的活动列表实现](https://raw.githubusercontent.com/TeX-Live/texlive-source/trunk/texk/web2c/pdftexdir/pdftex.web)
|
||||
|
||||
### 格式绑定 pdfTeX 修订 24
|
||||
|
||||
对照 TeX Live 1.40.23 和 1.40.24 发布差异,核对字距、自动字偶与
|
||||
悬挂标点、警告起行、`\showstream`、段落 token 及 PDF 结构目的地。
|
||||
单字符控制序列定义字距字体的追加探针中,字宽和实际列表逐字节一致。
|
||||
格式身份进入原生状态。冻结 schema50 格式继续报告修订22,按原样
|
||||
pdflatex.ini 重建的 schema51 在保存与加载时均报告修订24。
|
||||
原样 LaTeX 内核与后端使用相同的资源指纹,后者的修订判断启用真实
|
||||
结构目的地。原生 PDF 导出警告通过已有诊断通道独立起行,重复目标
|
||||
探针的 PDF 在改动前后逐字节一致。6项定向回归通过。
|
||||
[pdfTeX 发布记录](https://raw.githubusercontent.com/TeX-Live/texlive-source/trunk/texk/web2c/pdftexdir/NEWS)
|
||||
|
||||
修订24格式下编辑第二页的结构目标位置,复用1207步,只替换第二页。
|
||||
第一张页面的链接继续引用第二页移动后的结构目标。其位置由
|
||||
[9.963, 131.507]bp 变为 [13.948, 131.507]bp,PDF、SVG 和归一化
|
||||
来源映射均与独立零复用全量相同。
|
||||
|
||||
证据在 target/p3-pdftex24-native。三份回执的 SHA-256 分别为
|
||||
446b8115f3fe5f68b5bfc881299ab87516099b0c65f0aa785868d2222e4b1e31(格式身份),
|
||||
447786ac382c2f24d8f75dade124930ad501277ad156805cb1f9a8446e935658(原样格式),
|
||||
87005ba4acac608907af88a76120e5a569a71555789e954250e662c67e851946(续编)。
|
||||
[原样 ACM 的结构目标验收](PUBLISHER_TEMPLATE_MATRIX.md#acm-的三类官方样例)
|
||||
|
||||
### PDF 字面中的矩阵与来源映射
|
||||
|
||||
来源映射与 PDF 写入共用设备原点的取整。实际字面中的 `q`、`Q` 和
|
||||
|
||||
@@ -652,11 +652,28 @@ acmtog.tex:848 的文档结束处理。首个停止点为 `\tex_mdfivesum:D`,
|
||||
工作目录和生成文件记录继续,首轮文件归档在 `acm-bibliography/first-publication`。
|
||||
|
||||
最终原生有1个可解析的本地结构动作,29个缺失。参考有121个可解析动作。
|
||||
冻结后端要求 pdfTeX 修订24才启用结构目的地造点与链接。当前 profile 是
|
||||
1.40.22。出版版面、可访问性及统一验收仍待后续开发验证。
|
||||
冻结后端要求 pdfTeX 修订24才启用结构目的地造点与链接。该基线使用
|
||||
1.40.22。
|
||||
原生比较回执 `target/p3-pdf-structure-dest-native/acm-bibliography/comparison.json`
|
||||
的 SHA-256 为 `aa358583ee8d0f1857f8a861418e12cb12a0558e8a08247d97eec41c94eb3c6d`。
|
||||
|
||||
修订24的原样 pdflatex.ini 已重新转储。用相同44项文件、冻结字体映射和
|
||||
原样后端运行 ACM 双栏,生成7页标记 PDF 2.0。对照原有修订22的
|
||||
1个可解析及29个缺失动作,修订24第3到第5轮均解析121个本地结构动作。
|
||||
逐项目标名称、视图类型、结构角色及到结构树根的可达性与冻结参考一致。
|
||||
第4和第5轮的实际 PDF、aux 分别逐字节收敛;真实 BibTeX 输出与参考相同。
|
||||
40条文献标签、12条普通标签及29条书签记录逐字节一致。1049个标签属性
|
||||
在归一化结构对象号后全部一致。出版版面、广泛可访问性及统一模板验收仍待验证。
|
||||
|
||||
首轮验证脚本误将输出写到测试副本的附带 PDF,文件名与原始归档中的
|
||||
成品同名。保留首轮实际产物,按原始指纹恢复测试副本附带文件,并在
|
||||
同一作业下改用独立 PDF 输出名。后续逐轮校验44项原样输入、后端、格式
|
||||
和字体映射。首轮记录标为从实际出版文件恢复,后续均有完整退出码。
|
||||
回执位于 target/p3-pdftex24-native,ACM 回执 SHA-256 为
|
||||
9907d32fb26a8c10de863c047e9bb35b743011d9afc3ea2ea65ed88b5f52f499,
|
||||
结构目标回执 SHA-256 为
|
||||
732b23ca9d6e20528655d96c9e54d10617d2c104219bd2993bc519b1e96e902a。
|
||||
|
||||
最终矩阵 `target/publisher-template-matrix/acm-official/matrix-schema29-utf8/report.json`
|
||||
SHA-256 为 `d914d7c7dfa1ee28dff20e77231fef35e390041cde6180bcc361de83288ec9e1`。其 `preparation/acmart` 保存
|
||||
DocStrip 记录。同目录的前序依赖失败、补充包指纹和原样源均保留。用现有
|
||||
|
||||
+5
-2
@@ -33,7 +33,7 @@ use texrra_tex_core::{
|
||||
execution::{
|
||||
Cancellation, ExecutionFailure, Executor, FormatImage, InputProfile, JobTime, Limits,
|
||||
NativeSession, RevisionError, RevisionExecution, RevisionFailure, RevisionJob, SourceFile,
|
||||
SourceProvider, State,
|
||||
SourceProvider, State, WriteDestination,
|
||||
},
|
||||
render::DisplayList,
|
||||
resources::{FileWorld, InputSnapshot, ResourceTrace, ResourceVersion, WorldConfig},
|
||||
@@ -1123,7 +1123,10 @@ impl CompileJob {
|
||||
evidence.diagnostics = export_diagnostics.clone();
|
||||
notify(&request, revision, CompileStage::Exported, &cancellation)?;
|
||||
for warning in &export_diagnostics {
|
||||
files.observe_message(&format!("native PDF warning: {warning}"))?;
|
||||
files.observe_diagnostic(
|
||||
WriteDestination::TerminalAndLog,
|
||||
&format!("native PDF warning: {warning}\n"),
|
||||
)?;
|
||||
}
|
||||
evidence.phase = AttemptPhase::Finishing;
|
||||
let finished = files.finish();
|
||||
|
||||
@@ -348,7 +348,10 @@ fn original_a3_resume_uses_real_host_and_matches_independent_full_jobs() {
|
||||
.unwrap();
|
||||
for warning in &pdf.diagnostics {
|
||||
files
|
||||
.observe_message(&format!("native PDF warning: {warning}"))
|
||||
.observe_diagnostic(
|
||||
WriteDestination::TerminalAndLog,
|
||||
&format!("native PDF warning: {warning}\n"),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
files.finish().unwrap();
|
||||
|
||||
@@ -181,3 +181,33 @@ fn local_structure_action_references_the_shipped_structure_and_later_page() {
|
||||
assert_eq!(destination[1].as_name().unwrap(), b"FitR");
|
||||
fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_export_warning_starts_on_its_own_log_line() {
|
||||
let root = std::env::temp_dir().join(format!("texrra-pdf-warning-lines-{}", std::process::id()));
|
||||
let source = r"\catcode123=1 \catcode125=2
|
||||
\pdfoutput=1 \pdfmajorversion=2 \pdfminorversion=0
|
||||
\pdfcompresslevel=0 \pdfobjcompresslevel=0
|
||||
\immediate\pdfobj{<< /Type /StructElem /S /Sect >>}
|
||||
\count1=\pdflastobj
|
||||
\shipout\hbox{\pdfdest struct \count1 name{first} xyz
|
||||
\pdfdest struct \count1 name{first} xyz
|
||||
\pdfdest struct \count1 name{second} xyz
|
||||
\pdfdest struct \count1 name{second} xyz
|
||||
\vrule width4pt height3pt}
|
||||
\message{LAST-MESSAGE}
|
||||
\end";
|
||||
let doc = compile(&root, source, true);
|
||||
assert_eq!(doc.get_pages().len(), 1);
|
||||
let transcript = fs::read_to_string(root.join("native/probe.log")).unwrap();
|
||||
let descriptions: Vec<_> = transcript
|
||||
.lines()
|
||||
.filter_map(|line| line.strip_prefix("native PDF warning: "))
|
||||
.collect();
|
||||
assert_eq!(descriptions.len(), 2, "{transcript}");
|
||||
for (description, target) in descriptions.iter().zip(["first", "second"]) {
|
||||
assert!(description.contains(&format!("name{{{target}}}")));
|
||||
assert!(description.ends_with("duplicate ignored"));
|
||||
}
|
||||
fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
Reference in new issue
Block a user