Execute positioned TeX specials through native PDF devices
This commit is contained in:
1 parent
05e633bb14
commit
ce8a780031
21 files changed
+519
-29
No files matched your search
@@ -13,8 +13,23 @@ pub struct PdfFileOptions {
|
||||
pub decimal_digits: u8,
|
||||
pub pk_resolution: u32,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub enum PdfDriver {
|
||||
#[default]
|
||||
PdfTeX,
|
||||
Xdv,
|
||||
}
|
||||
|
||||
impl PdfDriver {
|
||||
fn is_pdftex(&self) -> bool {
|
||||
*self == Self::PdfTeX
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PdfPageData {
|
||||
#[serde(default, skip_serializing_if = "PdfDriver::is_pdftex")]
|
||||
pub driver: PdfDriver,
|
||||
pub file: PdfFileOptions,
|
||||
pub stream_compression: u8,
|
||||
}
|
||||
@@ -28,6 +43,13 @@ pub fn magnify(value: i64, mag: i32) -> i64 {
|
||||
((n + 500) / 1000) as i64
|
||||
}
|
||||
}
|
||||
/// Convert a physical dimension to the logical coordinates of a magnified page.
|
||||
pub(crate) fn unmagnify(value: i64, mag: i32) -> i64 {
|
||||
let mag = i64::from(mag);
|
||||
let n = value * 1000;
|
||||
n.signum() * ((n.abs() + mag / 2) / mag)
|
||||
}
|
||||
|
||||
pub fn divide_scaled(value: i64, denominator: i64, digits: u8) -> (i64, i64) {
|
||||
let scale = 10i128.pow(u32::from(digits));
|
||||
let n = i128::from(value).abs();
|
||||
|
||||
Reference in new issue
Block a user