Select a native XeTeX compatibility profile and wide spacing codes
This commit is contained in:
1 parent
651fab42f1
commit
752af43f32
19 files changed
+471
-115
No files matched your search
@@ -64,6 +64,15 @@ impl Executor {
|
||||
}
|
||||
}
|
||||
|
||||
fn pdf_output_mode(&mut self) -> i32 {
|
||||
match self.state.input_profile() {
|
||||
// XeTeX always sends shipouts to its device. The native job
|
||||
// renders those operations without a pdfTeX mode register.
|
||||
InputProfile::XeTeX => 1,
|
||||
_ => self.read_parameter(Parameter::Pdfoutput).width(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn validate_pdf_final_state(&mut self) -> Result<(), Error> {
|
||||
if let Some(options) = self.state.pdf_file_options.clone() {
|
||||
self.reads.insert(Dependency::GlyphUnicode);
|
||||
@@ -73,7 +82,7 @@ impl Executor {
|
||||
self.pdf_token_parameter_bytes(TokenParameter::Pdfpagesattr)?;
|
||||
}
|
||||
self.reads.insert(Dependency::PdfFileState);
|
||||
let mode = self.read_parameter(Parameter::Pdfoutput).width();
|
||||
let mode = self.pdf_output_mode();
|
||||
if self.state.output_mode_set != Some(mode) {
|
||||
return self.fail("native pdfoutput cannot change after output has started");
|
||||
}
|
||||
@@ -194,7 +203,7 @@ impl Executor {
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<Option<PdfPageData>, Error> {
|
||||
self.reads.insert(Dependency::PdfFileState);
|
||||
let mode = self.read_parameter(Parameter::Pdfoutput).width();
|
||||
let mode = self.pdf_output_mode();
|
||||
if self
|
||||
.state
|
||||
.output_mode_set
|
||||
@@ -262,7 +271,7 @@ impl Executor {
|
||||
}
|
||||
let driver = match self.state.input_profile() {
|
||||
InputProfile::TeX8Bit => PdfDriver::PdfTeX,
|
||||
InputProfile::UnicodeScalar => PdfDriver::Xdv,
|
||||
InputProfile::UnicodeScalar | InputProfile::XeTeX => PdfDriver::Xdv,
|
||||
};
|
||||
Ok(Some(PdfPageData {
|
||||
driver,
|
||||
|
||||
@@ -213,7 +213,7 @@ impl Executor {
|
||||
let rendered = self.token_list_text(&tokens);
|
||||
let profile = self.state.input_profile();
|
||||
let bytes = match profile {
|
||||
InputProfile::UnicodeScalar => rendered.into_bytes(),
|
||||
InputProfile::UnicodeScalar | InputProfile::XeTeX => rendered.into_bytes(),
|
||||
InputProfile::TeX8Bit => rendered
|
||||
.chars()
|
||||
.map(|c| {
|
||||
|
||||
@@ -10,7 +10,7 @@ impl Executor {
|
||||
InputProfile::TeX8Bit if !(0..=255).contains(&value) => {
|
||||
self.fail("mathcode index must be in 0..255")
|
||||
}
|
||||
InputProfile::UnicodeScalar if !(0..=0x10_ffff).contains(&value) => {
|
||||
InputProfile::UnicodeScalar | InputProfile::XeTeX if !(0..=0x10_ffff).contains(&value) => {
|
||||
self.fail("Bad character code")
|
||||
}
|
||||
_ => Ok(value as u32),
|
||||
|
||||
@@ -278,7 +278,7 @@ impl Executor {
|
||||
}
|
||||
let magnification = self.prepare_magnification()?;
|
||||
let pdf = self.pdf_page_data(files)?;
|
||||
let unicode_pages = self.state.input_profile() == InputProfile::UnicodeScalar;
|
||||
let unicode_pages = self.state.input_profile() != InputProfile::TeX8Bit;
|
||||
// The XDV driver uses a physical sheet and origin, then applies
|
||||
// magnification to the DVI movements relative to that origin.
|
||||
let origin = |value| {
|
||||
|
||||
@@ -351,7 +351,7 @@ impl Executor {
|
||||
return Ok(());
|
||||
}
|
||||
let font = self.state.text_font();
|
||||
let opentype = if self.state.input_profile() == super::super::InputProfile::UnicodeScalar {
|
||||
let opentype = if self.state.input_profile() != super::super::InputProfile::TeX8Bit {
|
||||
self.state.fonts.font(font).map_err(|e| self.error(e, token.span))?.opentype().cloned()
|
||||
} else {
|
||||
None
|
||||
@@ -363,9 +363,8 @@ impl Executor {
|
||||
if self.paragraph.is_none() {
|
||||
self.begin_paragraph(token.invocation.unwrap_or(token.span), true)?;
|
||||
}
|
||||
let space_factor = if let Some(slot) = slot {
|
||||
self.reads.insert(Dependency::SfCode(slot));
|
||||
self.state.sfcode(slot)
|
||||
let space_factor = if slot.is_some() || self.state.input_profile() == InputProfile::XeTeX {
|
||||
self.read_space_factor_code(u32::from(c))
|
||||
} else {
|
||||
1000
|
||||
};
|
||||
@@ -664,7 +663,7 @@ impl Executor {
|
||||
self.reads.insert(Dependency::FontResources);
|
||||
let defaults = self.font_defaults();
|
||||
let from = self.sources[self.current.source].name.clone();
|
||||
let request = if self.state.input_profile() == super::super::InputProfile::UnicodeScalar {
|
||||
let request = if self.state.input_profile() != super::super::InputProfile::TeX8Bit {
|
||||
crate::opentype::Request::parse(&file).map_err(|e| self.error(e, self.current))?
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -220,6 +220,7 @@ impl Executor {
|
||||
| Primitive::Pdflastypos
|
||||
| Primitive::Numexpr
|
||||
| Primitive::Etexversion
|
||||
| Primitive::XeTeXversion
|
||||
| Primitive::Currentgrouplevel
|
||||
| Primitive::Currentgrouptype
|
||||
| Primitive::Badness
|
||||
|
||||
@@ -225,7 +225,7 @@ impl Executor {
|
||||
}
|
||||
Key::Mathcodenum(_) => unreachable!("packed math code reads do not create save records"),
|
||||
Key::Delcode(c) => (format!("delcode{c}"), self.state.delcode(*c).to_string()),
|
||||
Key::Sfcode(c) => (format!("sfcode{c}"), self.state.sfcode(*c).to_string()),
|
||||
Key::Sfcode(c) => (format!("sfcode{c}"), self.state.space_factor_code(*c).to_string()),
|
||||
Key::CaseCode(kind, c) => (
|
||||
format!("{}{}", kind.name(), *c as u32),
|
||||
self.state.case_code(*kind, *c).to_string(),
|
||||
|
||||
Reference in new issue
Block a user