Execute and render TeX--XeT direction spans in native layouts

This commit is contained in:
gloamxun committed 2026-11-21 16:46:17 +08:00
1 parent a93d1bb902
commit 22e3ba993d
17 files changed
+460 -54

No files matched your search

@@ -381,6 +381,10 @@ pub enum Primitive {
Udelimiter,
Uradical,
Umathaccent,
BeginL,
EndL,
BeginR,
EndR,
}
impl Primitive {
@@ -1202,6 +1206,7 @@ impl Default for State {
| Parameter::Tracingnesting
| Parameter::Tracingassigns
| Parameter::Savingvdiscards
| Parameter::TeXXeTstate
) || Parameter::XETEX.contains(p) {
continue;
}
@@ -1491,6 +1496,7 @@ impl State {
);
}
self.install_xetex_etex_commands();
self.install_direction_commands();
self
}
pub fn register_limit(&self) -> u16 {
@@ -1647,6 +1653,7 @@ impl State {
}
self.install_unicode_commands();
self.install_xetex_etex_commands();
self.install_direction_commands();
self
}
@@ -1714,6 +1721,24 @@ impl State {
}
}
fn install_direction_commands(&mut self) {
let enabled = self.profile == Profile::EtexBootstrap
&& matches!(self.input_profile, super::InputProfile::TeX8Bit | super::InputProfile::XeTeX);
for (name, primitive) in [
("beginL", Primitive::BeginL),
("endL", Primitive::EndL),
("beginR", Primitive::BeginR),
("endR", Primitive::EndR),
] {
self.update_profile_command(name, Meaning::Primitive(primitive), enabled);
}
self.update_profile_command(
&Parameter::TeXXeTstate.name(),
Meaning::Parameter(Parameter::TeXXeTstate),
enabled,
);
}
pub(super) fn profile_primitive_name(&self, primitive: Primitive) -> Option<&'static str> {
if self.input_profile == super::InputProfile::XeTeX {
return XETEX_PRIMITIVE_ALIASES