Apply pdfTeX line box dimensions and restore output penalties
This commit is contained in:
1 parent
7f51f01bd4
commit
fb557c09c6
13 files changed
+151
-14
No files matched your search
@@ -1,6 +1,8 @@
|
||||
//! Owned paragraph parameter meanings and TeX INITEX defaults.
|
||||
use super::{Flex, Glue, RegisterKind, RegisterValue};
|
||||
|
||||
pub(super) const IGNORE_DEPTH: i32 = -1000 * 65536;
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, serde::Deserialize,
|
||||
)]
|
||||
@@ -148,6 +150,11 @@ pub enum Parameter {
|
||||
Ignoreprimitiveerror,
|
||||
Lastlinefit,
|
||||
Savinghyphcodes,
|
||||
Pdfignoreddimen,
|
||||
Pdfeachlineheight,
|
||||
Pdfeachlinedepth,
|
||||
Pdffirstlineheight,
|
||||
Pdflastlinedepth,
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub enum ParameterValue {
|
||||
@@ -155,6 +162,13 @@ pub enum ParameterValue {
|
||||
Quantity(RegisterValue),
|
||||
}
|
||||
impl Parameter {
|
||||
pub(super) const PDF_LINE_DIMENSIONS: [Self; 5] = [
|
||||
Self::Pdfignoreddimen,
|
||||
Self::Pdfeachlineheight,
|
||||
Self::Pdfeachlinedepth,
|
||||
Self::Pdffirstlineheight,
|
||||
Self::Pdflastlinedepth,
|
||||
];
|
||||
pub(super) fn pdftex_only(self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
@@ -191,6 +205,11 @@ impl Parameter {
|
||||
| Self::Pdfprependkern
|
||||
| Self::Pdfappendkern
|
||||
| Self::Pdfadjustspacing
|
||||
| Self::Pdfignoreddimen
|
||||
| Self::Pdfeachlineheight
|
||||
| Self::Pdfeachlinedepth
|
||||
| Self::Pdffirstlineheight
|
||||
| Self::Pdflastlinedepth
|
||||
)
|
||||
}
|
||||
|
||||
@@ -352,6 +371,11 @@ impl Parameter {
|
||||
Self::XeTeXinputnormalization,
|
||||
Self::Lastlinefit,
|
||||
Self::Savinghyphcodes,
|
||||
Self::Pdfignoreddimen,
|
||||
Self::Pdfeachlineheight,
|
||||
Self::Pdfeachlinedepth,
|
||||
Self::Pdffirstlineheight,
|
||||
Self::Pdflastlinedepth,
|
||||
];
|
||||
pub fn name(self) -> String {
|
||||
match self {
|
||||
@@ -381,6 +405,11 @@ impl Parameter {
|
||||
| Self::Pdflinkmargin
|
||||
| Self::Pdfdestmargin
|
||||
| Self::Pdfthreadmargin
|
||||
| Self::Pdfignoreddimen
|
||||
| Self::Pdfeachlineheight
|
||||
| Self::Pdfeachlinedepth
|
||||
| Self::Pdffirstlineheight
|
||||
| Self::Pdflastlinedepth
|
||||
| Self::Delimitershortfall
|
||||
| Self::Predisplaysize
|
||||
| Self::Displaywidth
|
||||
@@ -422,10 +451,10 @@ impl Parameter {
|
||||
pub fn initial(self) -> ParameterValue {
|
||||
if let Some(kind) = self.kind() {
|
||||
ParameterValue::Quantity(if kind == RegisterKind::Dimen {
|
||||
RegisterValue::Dimension(if matches!(self, Self::Pdfhorigin | Self::Pdfvorigin) {
|
||||
4_736_287
|
||||
} else {
|
||||
0
|
||||
RegisterValue::Dimension(match self {
|
||||
Self::Pdfhorigin | Self::Pdfvorigin => 4_736_287,
|
||||
p if Self::PDF_LINE_DIMENSIONS.contains(&p) => IGNORE_DEPTH,
|
||||
_ => 0,
|
||||
})
|
||||
} else {
|
||||
RegisterValue::Glue(Glue::default())
|
||||
|
||||
Reference in new issue
Block a user