Execute XeTeX Unicode delimiter codes and primitives
This commit is contained in:
1 parent
dba73f1f47
commit
01b3931ae0
13 files changed
+285
-45
No files matched your search
@@ -376,6 +376,10 @@ pub enum Primitive {
|
||||
XeTeXOTlanguagetag,
|
||||
XeTeXOTcountfeatures,
|
||||
XeTeXOTfeaturetag,
|
||||
Udelcode,
|
||||
Udelcodenum,
|
||||
Udelimiter,
|
||||
Uradical,
|
||||
}
|
||||
|
||||
impl Primitive {
|
||||
@@ -574,11 +578,12 @@ pub(super) enum Key {
|
||||
Spacefactor,
|
||||
Box(u16),
|
||||
Mathcode(u32),
|
||||
Delcode(u8),
|
||||
Delcode(u32),
|
||||
Sfcode(u32),
|
||||
CaseCode(super::CaseCode, char),
|
||||
Mathfont(u8, u8),
|
||||
Mathcodenum(u32),
|
||||
Delcodenum(u32),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
@@ -712,7 +717,7 @@ pub struct State {
|
||||
pub(super) split_marks: BTreeMap<u16, super::SplitMarks>,
|
||||
pub(super) page_marks: BTreeMap<u16, super::PageMarks>,
|
||||
mathcodes: BTreeMap<u32, super::MathCode>,
|
||||
delcodes: BTreeMap<u8, i32>,
|
||||
delcodes: BTreeMap<u32, i32>,
|
||||
#[serde(default)]
|
||||
sfcodes: BTreeMap<u32, u16>,
|
||||
#[serde(with = "ordered_map")]
|
||||
@@ -869,6 +874,14 @@ const XETEX_PRIMITIVE_ALIASES: &[(&str, Primitive)] = {
|
||||
("shellescape", Pdfshellescape),
|
||||
("strcmp", Pdfstrcmp),
|
||||
("uniformdeviate", Pdfuniformdeviate),
|
||||
("Udelcode", Udelcode),
|
||||
("XeTeXdelcode", Udelcode),
|
||||
("Udelcodenum", Udelcodenum),
|
||||
("XeTeXdelcodenum", Udelcodenum),
|
||||
("Udelimiter", Udelimiter),
|
||||
("XeTeXdelimiter", Udelimiter),
|
||||
("Uradical", Uradical),
|
||||
("XeTeXradical", Uradical),
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1850,12 +1863,15 @@ impl State {
|
||||
self.case_codes.insert((kind, c), value);
|
||||
}
|
||||
pub fn delcode(&self, c: u8) -> i32 {
|
||||
self.delimiter_code(u32::from(c))
|
||||
}
|
||||
pub(super) fn delimiter_code(&self, c: u32) -> i32 {
|
||||
self.delcodes
|
||||
.get(&c)
|
||||
.copied()
|
||||
.unwrap_or(if c == b'.' { 0 } else { -1 })
|
||||
.unwrap_or(if c == u32::from(b'.') { 0 } else { -1 })
|
||||
}
|
||||
pub(super) fn assign_delcode(&mut self, c: u8, n: i32, global: bool) {
|
||||
pub(super) fn assign_delcode(&mut self, c: u32, n: i32, global: bool) {
|
||||
self.save(Key::Delcode(c), global);
|
||||
self.delcodes.insert(c, n);
|
||||
}
|
||||
@@ -2134,7 +2150,9 @@ impl State {
|
||||
Key::Font => Saved::Font(self.text_font),
|
||||
Key::Box(n) => Saved::Box(self.boxes.get(n).cloned()),
|
||||
Key::Mathcode(c) => Saved::Mathcode(self.mathcodes.get(c).copied()),
|
||||
Key::Mathcodenum(_) => unreachable!("packed math code reads do not create save records"),
|
||||
Key::Mathcodenum(_) | Key::Delcodenum(_) => {
|
||||
unreachable!("packed code reads do not create save records")
|
||||
}
|
||||
Key::Delcode(c) => Saved::Delcode(self.delcodes.get(c).copied()),
|
||||
Key::Sfcode(c) => Saved::Sfcode(self.sfcodes.get(c).copied()),
|
||||
Key::CaseCode(kind, c) => Saved::CaseCode(self.case_codes.get(&(*kind, *c)).copied()),
|
||||
|
||||
Reference in new issue
Block a user